Skip Navigation

[Resolved] Uncaught TypeError in Layouts wheb opening Content Layout Editor

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+00:00)

This topic contains 2 replies, has 2 voices.

Last updated by erikd-6 9 months ago.

Assisted by: Nigel.

Author
Posts
#2684093

I am trying to: Open the content Layout Editor

Link to a page where the issue can be seen: hidden link

I expected to see: the content layout editor

Instead, I got: the content layout editor waiting eternally to open and a message about a critical error on the bottom

The error log reports:

Een fout van het type E_ERROR werd veroorzaakt op regelnummer 1334 van het bestand /home/pkbsur/public_html/wp-content/plugins/layouts/classes/wpddl.class.php. Foutmelding: Uncaught TypeError: method_exists(): Argument #1 ($object_or_class) must be of type object|string, null given in /home/pkbsur/public_html/wp-content/plugins/layouts/classes/wpddl.class.php:1334
Stack trace:
#0 /home/pkbsur/public_html/wp-content/plugins/layouts/classes/wpddl.class.php(1334): method_exists()
#1 /home/pkbsur/public_html/wp-content/plugins/woocommerce-views/library/toolset/woocommerce-views/Class_WooCommerce_Views.php(10537): WPDD_Layouts->get_where_used()
#2 /home/pkbsur/public_html/wp-content/plugins/woocommerce-views/library/toolset/woocommerce-views/Class_WooCommerce_Views.php(10079): Class_WooCommerce_Views->wcviews_get_loaded_layout_assignment_specific()
#3 /home/pkbsur/public_html/wp-includes/class-wp-hook.php(324): Class_WooCommerce_Views->wcviews_filter_loop_related_shortcodes_layouts()
#4 /home/pkbsur/public_html/wp-includes/plugin.php(205): WP_Hook->apply_filters()
#5 /home/pkbsur/public_html/wp-content/plugins/woocommerce-views/application/Helpers/wcviews-shortcodes-gui.php(207): apply_filters()
#6 /home/pkbsur/public_html/wp-includes/class-wp-hook.php(324): WCViews_shortcodes_gui->register_shortcodes_dialog_groups()
#7 /home/pkbsur/public_html/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters()
#8 /home/pkbsur/public_html/wp-includes/plugin.php(517): WP_Hook->do_action()
#9 /home/pkbsur/public_html/wp-content/plugins/wp-views/embedded/inc/classes/wpv-shortcode-generator.php(1111): do_action()
#10 /home/pkbsur/public_html/wp-includes/class-wp-hook.php(324): WPV_Shortcode_Generator->render_footer_dialogs()
#11 /home/pkbsur/public_html/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters()
#12 /home/pkbsur/public_html/wp-includes/plugin.php(517): WP_Hook->do_action()
#13 /home/pkbsur/public_html/wp-admin/admin-footer.php(78): do_action()
#14 /home/pkbsur/public_html/wp-admin/admin.php(297): require_once('/home/pkbsur/pu...')
#15 {main}
thrown

#2684122

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Hi Erik

I was able to reproduce the problem on a local test site. It occurs after updating PHP to 8.x (I'm not sure what version exactly).

I've escalated the issue to the developers, but I identified where in the code the problem arises, and as a workaround until Layouts is updated you can workaround the problem by updating the file plugins/layouts/classes/wpddl.class.php

Around line 1334 you should see the following if statement:

if ( is_object( $layout ) === false && method_exists( $layout, 'get_post_slug' ) === false ) {
	return null;
}

Please change that to look like this:

if ( !( is_object($layout) && method_exists($layout, 'get_post_slug') ) ) {
	return null;
}

The next update to Layouts should include the fix as it is very simple, though I'm not sure when that will be.

Let me know that it works.

#2684284

Hi Nigel, thank you for your quick response. I have performed the patch and this has solved the problem.