• Resolved Antony Booker

    (@antonynz)


    I’m getting the following fatal error on the front end on some pages when upgraded to 20.2

    The $images variable is returning null with 20.2 whereas with 20.1 it’s returning an empty array, which doesn’t cause the fatal error with the reset function.

    [28-Feb-2023 23:26:25 UTC] PHP Fatal error:  Uncaught TypeError: reset(): Argument #1 ($array) must be of type array, null given in /wp-content/addons/wordpress-seo/src/integrations/front-end/open-graph-oembed.php:118
    Stack trace:
    #0 /wp-content/addons/wordpress-seo/src/integrations/front-end/open-graph-oembed.php(118): reset(NULL)
    #1 /wp-content/addons/wordpress-seo/src/integrations/front-end/open-graph-oembed.php(86): Yoast\WP\SEO\Integrations\Front_End\Open_Graph_OEmbed->set_image()
    #2 /wp-includes/class-wp-hook.php(310): Yoast\WP\SEO\Integrations\Front_End\Open_Graph_OEmbed->set_oembed_data(Array, Object(WP_Post))
    #3 /wp-includes/plugin.php(205): WP_Hook->apply_filters(Array, Array)
    #4 /wp-includes/embed.php(607): apply_filters('oembed_response...', Array, Object(WP_Post), 200, 200)
    #5 /wp-includes/embed.php(677): get_oembed_response_data(Object(WP_Post), 200)
    #6 /wp-includes/embed.php(1237): get_oembed_response_data_for_url('https://...', '')
    #7 /wp-includes/class-wp-hook.php(308): wp_filter_pre_oembed_result(NULL, 'https://...', '')
    #8 /wp-includes/plugin.php(205): WP_Hook->apply_filters(NULL, Array)
    #9 /wp-includes/class-wp-oembed.php(398): apply_filters('pre_oembed_resu...', NULL, 'https://...', '')
    #10 /wp-includes/embed.php(115): WP_oEmbed->get_html('https://...', '')
Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support Maybellyne

    (@maybellyne)

    Hello @antonynz

    I’m sorry about the error you experienced after updating to Yoast SEO v20.2. To troubleshoot and understand the severity, we’d like some more information:

    • Have you completed the SEO data optimization?
    • Can you confirm if you toggled the button in WordPress > Yoast SEO > Settings > Advanced > Media pages to Enable Media pages?
    • You mentioned that the fatal error occurs on the front end on some pages. Do you notice anything common to all those pages?
    • Have you added the filters?wpseo_add_opengraph_images?or wpseo_add_opengraph_additional_images?anywhere in your code, like the functions.php file?
    • Are there other PHP errors/notices/warnings in the error logs right before that one?

    We look forward to hearing from you.

    Thread Starter Antony Booker

    (@antonynz)

    Thanks for the reply.

    • SEO data is optimized under Tools
    • Indexing of media is disabled
    • I have traced it down to a custom media type called iframe/oembed that is requested via the oembed method on those pages. It’s an unusual set up and I couldn’t find the change of code that caused that to return null yet but will have another look
    • Have not found any filters outside the plugin with a grep search
    • Yes with debug on I am getting the warnings below
    [02-Mar-2023 09:37:48 UTC] PHP Warning:  Attempt to read property "open_graph_title" on bool in /wordpress-seo/src/integrations/front-end/open-graph-oembed.php on line 95
    [02-Mar-2023 09:37:48 UTC] PHP Warning:  Attempt to read property "open_graph_description" on bool in /wordpress-seo/src/integrations/front-end/open-graph-oembed.php on line 106
    [02-Mar-2023 09:37:48 UTC] PHP Warning:  Attempt to read property "open_graph_images" on bool in /wordpress-seo/src/integrations/front-end/open-graph-oembed.php on line 117
    Plugin Support Maybellyne

    (@maybellyne)

    Thanks for the infformation, @antonynz

    Are you able to identify the plugin that adds the custom media type? You can find out through a conflict check. The fastest way to rule out conflict is to deactivate all non-Yoast plugins and switch to a standard theme like Twenty Twenty-Two.

    Please test this on your development or staging site if you have one. If not, we recommend using the Health Check & Troubleshooting plugin. This plugin has a troubleshooting mode, which does not affect normal visitors to your site.

    If you’re unfamiliar with checking for conflicts, we’d like to point you to a step-by-step guide that will walk you through the process: How to check for plugin conflicts

    Do let us know how it goes.

    Jeroen Rotty

    (@jeroenrotty)

    This thread was marked resolved due to a lack of activity, but you’re always welcome to re-open the topic. Please read this post before opening a new request.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Fatal error with opengraph on 20.2’ is closed to new replies.