Fatal errors on metaboxes with Classic Editor when WP_DEBUG is true
-
Hi,
I was doing some testing with WooCommerce and the WP 5.0 beta and I noticed an issue. Here’s how to reproduce and what happens:
1. I tested with the latest 5.0 beta released yesterday, a recent version of WooCommerce (version 3.4+) that adds the ‘”__block_editor_compatible_meta_box” => false’ flag to force the classic editor on Products, Coupons, Orders, etc., and the latest version of the Classic Editor plugin.
2. When WP_DEBUG is true, navigating to any Product/Order/etc. page causes fatal errors on the metaboxes:
Fatal error: Uncaught ReflectionException: Function WC_Meta_Box_Product_Images::output() does not exist in /srv/www/woodev/wp-admin/includes/template.php:1100
Stack trace:
#0 /srv/www/woodev/wp-admin/includes/template.php(1100): ReflectionFunction->__construct(‘WC_Meta_Box_Pro…’)
#1 /srv/www/woodev/wp-admin/edit-form-advanced.php(707): do_meta_boxes(Object(WP_Screen), ‘side’, Object(WP_Post))
#2 /srv/www/woodev/wp-admin/post.php(179): include(‘/srv/www/woodev…’)
#3 {main} thrown in /srv/www/woodev/wp-admin/includes/template.php on line 11003. When WP_DEBUG is false all the metaboxes render properly.
The error seems to be coming from the code block in wp-admin/includes/template.php lines 1096-1129 that only gets processed when WP_DEBUG is true and seems to be related to the ReflectionFunction class. As you can see here (https://github.com/woocommerce/woocommerce/blob/d0491072e8a7d0a4535db0ec2bae4a6d43ff64fd/includes/admin/meta-boxes/class-wc-meta-box-product-images.php#L27) the function “causing the fatal error” definitely exists.
I’m still investigating the root cause and digging through the new code in WP core and will post back if I discover something, but I thought I’d give a heads-up.
Thanks.
- The topic ‘Fatal errors on metaboxes with Classic Editor when WP_DEBUG is true’ is closed to new replies.