• Resolved isarisar

    (@isarisar)


    One of our employees managed to produce this on repeat in the backend.

    Unfortunately I don’t know what she did, but it’s definitely a type error that used to be silently ignored (as implicit conversion) in PHP7 but is now fatal in PHP8:

    PHP Fatal error: Uncaught TypeError: method_exists(): Argument #1 ($object_or_class) must be of type object|string, null given in /srv/wp-content/plugins/yikes-inc-easy-custom-woocommerce-product-tabs/public/class.yikes-woo-tabs-display.php:41
    Stack trace:
    #0 /srv/wp-content/plugins/yikes-inc-easy-custom-woocommerce-product-tabs/public/class.yikes-woo-tabs-display.php(41): method_exists()
    #1 /srv/wp-includes/class-wp-hook.php(307): YIKES_Custom_Product_Tabs_Display->add_custom_product_tabs()
    #2 /srv/wp-includes/plugin.php(189): WP_Hook->apply_filters()
    #3 /srv/wp-content/themes/Divi/includes/builder/module/woocommerce/Tabs.php(359): apply_filters()
    #4 /srv/wp-content/themes/Divi/includes/builder/module/woocommerce/Tabs.php(253): ET_Builder_Module_Woocommerce_Tabs::get_tabs()
    #5 /srv/wp-content/themes/Divi/includes/builder/module/Tabs.php(218): ET_Builder_Module_Woocommerce_Tabs->get_tabs_content()
    #6 /srv/wp-content/themes/Divi/includes/builder/class-et-builder-element.php(3329): ET_Builder_Module_Tabs->render()
    #7 /srv/wp-includes/shortcodes.php(356): ET_Builder_Element->_render()
    #8 [internal function]: do_shortcode_tag()
    #9 /srv/wp-includes/shortcodes.php(228): preg_replace_callback()
    #10 /srv/wp-content/themes/Divi/includes/builder/main-structure-elements.php(3776): do_shortcode()
    #11 /srv/wp-content/themes/Divi/includes/builder/class-et-builder-element.php(3329): ET_Builder_Column->render()
    #12 /srv/wp-includes/shortcodes.php(356): ET_Builder_Element->_render()
    #13 [internal function]: do_shortcode_tag()
    #14 /srv/wp-includes/shortcodes.php(228): preg_replace_callback()
    #15 /srv/wp-content/themes/Divi/includes/builder/main-structure-elements.php(2270): do_shortcode()
    #16 /srv/wp-content/themes/Divi/includes/builder/class-et-builder-element.php(3329): ET_Builder_Row->render()
    #17 /srv/wp-includes/shortcodes.php(356): ET_Builder_Element->_render()
    #18 [internal function]: do_shortcode_tag()
    #19 /srv/wp-includes/shortcodes.php(228): preg_replace_callback()
    #20 /srv/wp-content/themes/Divi/includes/builder/main-structure-elements.php(1602): do_shortcode()
    #21 /srv/wp-content/themes/Divi/includes/builder/class-et-builder-element.php(3329): ET_Builder_Section->render()
    #22 /srv/wp-includes/shortcodes.php(356): ET_Builder_Element->_render()
    #23 [internal function]: do_shortcode_tag()
    #24 /srv/wp-includes/shortcodes.php(228): preg_replace_callback()
    #25 /srv/wp-content/themes/Divi/includes/builder/functions.php(2552): do_shortcode()
    #26 /srv/wp-includes/class-wp-hook.php(307): et_fb_get_shortcode_from_fb_object()
    #27 /srv/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters()
    #28 /srv/wp-includes/plugin.php(474): WP_Hook->do_action()
    #29 /srv/wp-admin/admin-ajax.php(187): do_action()
    #30 {main}
    thrown in /srv/wp-content/plugins/yikes-inc-easy-custom-woocommerce-product-tabs/public/class.yikes-woo-tabs-display.php on line 41

    CPT 1.7.7
    WC 6.4.1
    WP 5.9.3
    Divi 4.17.3
    PHP 8.0.17

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter isarisar

    (@isarisar)

    Another path to the same error:

    PHP Fatal error:  Uncaught TypeError: method_exists(): Argument #1 ($object_or_class) must be of type object|string, null given in /srv/wp-content/plugins/yikes-inc-easy-custom-woocommerce-product-tabs/public/class.yikes-woo-tabs-display.php:41
    Stack trace:
    #0 /srv/wp-content/plugins/yikes-inc-easy-custom-woocommerce-product-tabs/public/class.yikes-woo-tabs-display.php(41): method_exists()
    #1 /srv/wp-includes/class-wp-hook.php(307): YIKES_Custom_Product_Tabs_Display->add_custom_product_tabs()
    #2 /srv/wp-includes/plugin.php(189): WP_Hook->apply_filters()
    #3 /srv/wp-content/themes/Divi/includes/builder/module/woocommerce/Tabs.php(359): apply_filters()
    #4 /srv/wp-content/themes/Divi/includes/builder/feature/woocommerce-modules.php(2148): ET_Builder_Module_Woocommerce_Tabs::get_tabs()
    #5 /srv/wp-includes/class-wp-hook.php(307): et_builder_get_woocommerce_tabs()
    #6 /srv/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters()
    #7 /srv/wp-includes/plugin.php(474): WP_Hook->do_action()
    #8 /srv/wp-admin/admin-ajax.php(187): do_action()
    #9 {main}
      thrown in /srv/wp-content/plugins/yikes-inc-easy-custom-woocommerce-product-tabs/public/class.yikes-woo-tabs-display.php on line 41

    Suffices to do
    1. Products → Add New
    2. click “Use The Divi Builder” to launch it

    For the same error & resolution, see click here. Seems to be: First check with isset for $product & if it doesn’t exist return $tabs unaltered.

    Hi @isarisar,

    There’s a few things at play here. The first being that the Divi Builder is a premium plugin, and we don’t have a copy of it. It would not be reasonable for us to purchase a copy of each premium plugin that fails to be compatible with our own.

    That being said, I can provide some insight into what this issue is. Basically, our plugin uses this WooCommerce hook to modify the array of tabs for a given product. In that hook, the global $product variable is expected to be defined. Divi Builder seems to be manually calling that hook without the global $product variable being in scope, and as such the code fails.

    You have identified a potential solution to the PHP error, but that likely won’t solve the underlying compatibility issues between our two plugins. If the $product variable is not defined when the WooCommerce hook is called, our plugin won’t be able to provide a list of tabs.

    Divi comes with its own custom tabs module. After addressing several issues with their page builder similar to this one, I’d have to recommend that you use that instead if you’re set on using Divi.

    Alternatively, if you’d like to utilize your access to that plugin to develop a stable solution to this problem, you’re welcome to open a pull request – https://github.com/yikesinc/yikes-inc-easy-custom-woocommerce-product-tabs.

    Thanks,
    Jon

    Thread Starter isarisar

    (@isarisar)

    Hi Jon,

    thank you for taking the time to write a detailed explanation.

    I’ll have to locate the problem in Divi (or some other plugin involved) then, there’s indeed no point in adding a hack around it into CPT as the issue is likely just going to blow up elsewhere eventually.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘PHP8 Fatal TypeError Error’ is closed to new replies.