• Resolved Danny

    (@dannyfoo)


    Running on Qudos theme with WP 6.7.1, PHP 8.1.3 and SlimSEO 4.1.1

    [26-Nov-2024 05:32:49 UTC] PHP Fatal error: Uncaught TypeError: SlimSEO\Integrations\MetaBox\MetaBox::remove_built_in(): Argument?#1?($meta_box) must be of type RW_Meta_Box, RW_Meta_Box_GT3 given in /home/domain/public_html/wp-content/plugins/slim-seo/src/Integrations/MetaBox/MetaBox.php:72
    Stack trace:
    #0?[internal function]: SlimSEO\Integrations\MetaBox\MetaBox->remove_built_in()
    #1?/home/domain/public_html/wp-content/plugins/slim-seo/src/Integrations/MetaBox/MetaBox.php(67): array_filter()
    #2?/home/domain/public_html/wp-content/plugins/slim-seo/src/Integrations/MetaBox/MetaBox.php(52): SlimSEO\Integrations\MetaBox\MetaBox->get_meta_boxes()
    #3?/home/domain/public_html/wp-includes/class-wp-hook.php(324): SlimSEO\Integrations\MetaBox\MetaBox->add_data()
    #4?/home/domain/public_html/wp-includes/plugin.php(205): WP_Hook->apply_filters()
    #5?/home/domain/public_html/wp-content/plugins/slim-seo/src/MetaTags/Data.php(32): apply_filters()
    #6?/home/domain/public_html/wp-content/plugins/slim-seo/src/MetaTags/Helper.php(144): SlimSEO\MetaTags\Data->collect()
    #7?/home/domain/public_html/wp-content/plugins/slim-seo/src/MetaTags/Helper.php(126): SlimSEO\MetaTags\Helper::render_dynamic_variables()
    #8?/home/domain/public_html/wp-content/plugins/slim-seo/src/MetaTags/Description.php(34): SlimSEO\MetaTags\Helper::render()
    #9?/home/domain/public_html/wp-content/plugins/slim-seo/src/MetaTags/Description.php(25): SlimSEO\MetaTags\Description->get_description()
    #10?/home/domain/public_html/wp-includes/class-wp-hook.php(324): SlimSEO\MetaTags\Description->output()
    #11?/home/domain/public_html/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters()
    #12?/home/domain/public_html/wp-includes/plugin.php(517): WP_Hook->do_action()
    #13?/home/domain/public_html/wp-includes/general-template.php(3064): do_action()
    #14?/home/domain/public_html/wp-content/plugins/elementor/modules/page-templates/templates/canvas.php(19): wp_head()
    #15?/home/domain/public_html/wp-includes/template-loader.php(106): include('/home/domain/pu...')
    #16?/home/domain/public_html/wp-blog-header.php(19): require_once('/home/domain/pu...')
    #17?/home/domain/public_html/index.php(17): require('/home/domain/pu...')
    #18?{main}
    thrown in /home/domain/public_html/wp-content/plugins/slim-seo/src/Integrations/MetaBox/MetaBox.php on line 72

    Theme developer insists that it’s the plugin issue. Sigh.

    Do you think so?

Viewing 12 replies - 1 through 12 (of 12 total)
  • Plugin Author Anh Tran

    (@rilwis)

    Hi @dannyfoo ,

    This error comes from the integration for Meta Box. The official Meta Box plugin uses class RW_Meta_Box in their code. However, this theme author modifies the code from Meta Box and creates another classname RW_Meta_Box_GT3, which is not the same.

    While we can support this by removing the check for the class, it’s better to do this way:

    • Keep the current check for class name in Slim SEO, because it helps ensuring the integration is intended for Meta Box, not for a variant of it.
    • Ask the theme author to update their code, simply by making their class extends the Meta Box class, instead of copy & rewrite the class name. This way, they can have their own things in their class, including their own name, but their class is now compatible with Meta Box (and with this compatibility, the theme will support all extensions from Meta Box, which is a good thing, too).
    Kelly Oswald

    (@kellyoswald)

    Hi @rilwis

    I’m with GT3 team. Can you please explain the following:

    The error occurs because the remove_built_in() method of the class SlimSEO\Integrations\MetaBox\MetaBoxexpects an argument of type RW_Meta_Box, but it receives an argument of type RW_Meta_Box_GT3.

    • Method?remove_built_in(): This method was called with an incorrect argument type.
    • Expected?RW_Meta_Box, but got?RW_Meta_Box_GT3: This means the type of the object being passed to the method does not match what is expected.

    Why does it get ours instead of the exact one RW_Meta_Box ?

    We’ve renamed it long time ago to avoid the conflicts.

    Thanks

    Plugin Author Anh Tran

    (@rilwis)

    Hi @kellyoswald,

    Please check the code of Slim SEO here. The logic is: Slim SEO gets all meta boxes registered by Meta Box, and removes some meta boxes that were created for internal used (inside the Meta Box plugin). This helps to remove unwanted fields from the list of suggestions.

    While you rename your class to avoid conflicts, your meta boxes are still registered and added to the Meta Box’s registry. See this file for details. So basically, your class is registered as a normal meta box, but uses a different class name.

    I’d suggest extending the RW_Meta_Box class instead of changing the class name. That way it reduces conflicts and also keep your code compatible with everything from Meta Box.

    Kelly Oswald

    (@kellyoswald)

    @rilwis Thanks for your prompt response. The issue is that we have more than 100k customers and we are not sure that it’s an easy solution to keep your ?RW_Meta_Box?class by extending it. Is there an easier way, maybe on your end to exclude our class? Thanks for understanding.

    Plugin Author Anh Tran

    (@rilwis)

    Hi @kellyoswald,

    No problems, the fix is easy on our end, but it reduces the code quality for us :(. I created it here on Github, please verify if that works for you.

    Kelly Oswald

    (@kellyoswald)

    @dannyfoo Hello! Can you please check the above mentioned fix on your end? Thanks

    Thread Starter Danny

    (@dannyfoo)

    Tried removing the RW_Meta_Box and it still returned below error:

    [29-Nov-2024 02:33:30 UTC] PHP Fatal error:  Uncaught TypeError: SlimSEO\Integrations\MetaBox\Renderer::__construct(): Argument #1 ($meta_box) must be of type RW_Meta_Box, RW_Meta_Box_GT3 given, called in /home/domain/public_html/wp-content/plugins/slim-seo/src/Integrations/MetaBox/MetaBox.php on line 57 and defined in /home/domain/public_html/wp-content/plugins/slim-seo/src/Integrations/MetaBox/Renderer.php:13
    Stack trace:
    #0 /home/domain/public_html/wp-content/plugins/slim-seo/src/Integrations/MetaBox/MetaBox.php(57): SlimSEO\Integrations\MetaBox\Renderer->__construct()
    #1 /home/domain/public_html/wp-includes/class-wp-hook.php(324): SlimSEO\Integrations\MetaBox\MetaBox->add_data()
    #2 /home/domain/public_html/wp-includes/plugin.php(205): WP_Hook->apply_filters()
    #3 /home/domain/public_html/wp-content/plugins/slim-seo/src/MetaTags/Data.php(32): apply_filters()
    #4 /home/domain/public_html/wp-content/plugins/slim-seo/src/MetaTags/Helper.php(144): SlimSEO\MetaTags\Data->collect()
    #5 /home/domain/public_html/wp-content/plugins/slim-seo/src/MetaTags/Helper.php(126): SlimSEO\MetaTags\Helper::render_dynamic_variables()
    #6 /home/domain/public_html/wp-content/plugins/slim-seo/src/MetaTags/Description.php(34): SlimSEO\MetaTags\Helper::render()
    #7 /home/domain/public_html/wp-content/plugins/slim-seo/src/MetaTags/Description.php(25): SlimSEO\MetaTags\Description->get_description()
    #8 /home/domain/public_html/wp-includes/class-wp-hook.php(324): SlimSEO\MetaTags\Description->output()
    #9 /home/domain/public_html/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters()
    #10 /home/domain/public_html/wp-includes/plugin.php(517): WP_Hook->do_action()
    #11 /home/domain/public_html/wp-includes/general-template.php(3064): do_action()
    #12 /home/domain/public_html/wp-content/plugins/elementor/modules/page-templates/templates/canvas.php(19): wp_head()
    #13 /home/domain/public_html/wp-includes/template-loader.php(106): include('/home/domain/pu...')
    #14 /home/domain/public_html/wp-blog-header.php(19): require_once('/home/domain/pu...')
    #15 /home/domain/public_html/index.php(17): require('/home/domain/pu...')
    #16 {main}
    thrown in /home/domain/public_html/wp-content/plugins/slim-seo/src/Integrations/MetaBox/Renderer.php on line 13
    Plugin Author Anh Tran

    (@rilwis)

    Hi @dannyfoo ,

    I’ve just updated the PR. Can you please try again?

    Thread Starter Danny

    (@dannyfoo)

    The 2 changes works for the GT3 theme now.

    P.S. Will the changes be omitted in future SlimSEO plugin updates?

    Plugin Author Anh Tran

    (@rilwis)

    Yes, it will. I’ll finalizing some things and will probably release a new version on Monday.

    Thread Starter Danny

    (@dannyfoo)

    Thank you so much for the great support @rilwis and your help with this @kellyoswald

    Kelly Oswald

    (@kellyoswald)

    Thanks for the taking care of this issue.

Viewing 12 replies - 1 through 12 (of 12 total)
  • You must be logged in to reply to this topic.