• Resolved Kevin Pirnie

    (@kevp75)


    PHP Version: 8.0
    Host: WPEngine
    Error Message:
    PHP Fatal error: Uncaught TypeError: array_keys(): Argument #1 ($array) must be of type array, bool given in /MY/PATH/TO/MY_INSTALL/wp-content/plugins/wordpress-seo/src/generators/breadcrumbs-generator.php:194\nStack trace:\n#0 /MY/PATH/TO/MY_INSTALL/wp-content/plugins/wordpress-seo/src/generators/breadcrumbs-generator.php(194): array_keys(false)\n#1 /MY/PATH/TO/MY_INSTALL/wp-content/plugins/wordpress-seo/src/presentations/indexable-presentation.php(749): Yoast\\WP\\SEO\\Generators\\Breadcrumbs_Generator->generate(Object(Yoast\\WP\\SEO\\Context\\Meta_Tags_Context))\n#2 /MY/PATH/TO/MY_INSTALL/wp-content/plugins/wordpress-seo/src/presentations/abstract-presentation.php(64): Yoast\\WP\\SEO\\Presentations\\Indexable_Presentation->generate_breadcrumbs()\n#3 /MY/PATH/TO/MY_INSTALL/wp-content/plugins/wordpress-seo/src/generators/schema/breadcrumb.php(33): Yoast\\WP\\SEO\\Presentations\\Abstract_Presentation->__get('breadcrumbs')\n#4 /MY/PATH/TO/MY_INSTALL/wp-content/plugins/wordpress-seo/src/generators/schema-generator.php(128): Yoast\\WP\\SEO\\Generators\\Schema\\Breadcrumb->generate()\n#5 /MY/PATH/TO/MY_INSTALL/wp-content/plugins/wordpress-seo/src/generators/schema-generator.php(76): Yoast\\WP\\SEO\\Generators\\Schema_Generator->generate_graph(Array, Object(Yoast\\WP\\SEO\\Context\\Meta_Tags_Context))\n#6 /MY/PATH/TO/MY_INSTALL/wp-content/plugins/wordpress-seo/src/presentations/indexable-presentation.php(738): Yoast\\WP\\SEO\\Generators\\Schema_Generator->generate(Object(Yoast\\WP\\SEO\\Context\\Meta_Tags_Context))\n#7 /MY/PATH/TO/MY_INSTALL/wp-content/plugins/wordpress-seo/src/presentations/abstract-presentation.php(64): Yoast\\WP\\SEO\\Presentations\\Indexable_Presentation->generate_schema()\n#8 /MY/PATH/TO/MY_INSTALL/wp-content/plugins/wordpress-seo/src/presenters/schema-presenter.php(60): Yoast\\WP\\SEO\\Presentations\\Abstract_Presentation->__get('schema')\n#9 /MY/PATH/TO/MY_INSTALL/wp-content/plugins/wordpress-seo/src/presenters/schema-presenter.php(44): Yoast\\WP\\SEO\\Presenters\\Schema_Presenter->get()\n#10 /MY/PATH/TO/MY_INSTALL/wp-content/plugins/wordpress-seo/src/integrations/front-end-integration.php(324): Yoast\\WP\\SEO\\Presenters\\Schema_Presenter->present()\n#11 /MY/PATH/TO/MY_INSTALL/wp-includes/class-wp-hook.php(307): Yoast\\WP\\SEO\\Integrations\\Front_End_Integration->present_head('')\n#12 /MY/PATH/TO/MY_INSTALL/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters('', Array)\n#13 /MY/PATH/TO/MY_INSTALL/wp-includes/plugin.php(474): WP_Hook->do_action(Array)\n#14 /MY/PATH/TO/MY_INSTALL/wp-content/plugins/wordpress-seo/src/integrations/front-end-integration.php(298): do_action('wpseo_head')\n#15 /MY/PATH/TO/MY_INSTALL/wp-includes/class-wp-hook.php(307): Yoast\\WP\\SEO\\Integrations\\Front_End_Integration->call_wpseo_head('')\n#16 /MY/PATH/TO/MY_INSTALL/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters(NULL, Array)\n#17 /MY/PATH/TO/MY_INSTALL/wp-includes/plugin.php(474): WP_Hook->do_action(Array)\n#18 /MY/PATH/TO/MY_INSTALL/wp-includes/general-template.php(3042): do_action('wp_head')\n#19 /MY/PATH/TO/MY_INSTALL/wp-content/themes/lsne/header.php(19): wp_head()\n#20 /MY/PATH/TO/MY_INSTALL/wp-includes/template.php(770): require_once('/nas/content/li...')\n#21 /MY/PATH/TO/MY_INSTALL/wp-includes/template.php(716): load_template('/nas/content/li...', true, Array)\n#22 /MY/PATH/TO/MY_INSTALL/wp-includes/general-template.php(48): locate_template(Array, true, true, Array)\n#23 /MY/PATH/TO/MY_INSTALL/wp-content/themes/lsne/front-page.php(10): get_header()\n#24 /MY/PATH/TO/MY_INSTALL/wp-includes/template-loader.php(106): include('/nas/content/li...')\n#25 /MY/PATH/TO/MY_INSTALL/wp-blog-header.php(19): require_once('/nas/content/li...')\n#26 /MY/PATH/TO/MY_INSTALL/index.php(17): require('/nas/content/li...')\n#27 {main}\n thrown in /MY/PATH/TO/MY_INSTALL/wp-content/plugins/wordpress-seo/src/generators/breadcrumbs-generator.php on line 194, referer: https://MY_SITE.com/wp-login.php?loggedout=true&wp_lang=en_US

    QUICK FIX: change line 194 in /wp-content/plugins/wordpress-seo/src/generators/breadcrumbs-generator.php to read: return \array_map( $filter_callback, ( array ) $crumbs, \array_keys( ( array ) $crumbs ) );

Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter Kevin Pirnie

    (@kevp75)

    adding tag

    Plugin Support Michael Tiña

    (@mikes41720)

    Hi @kevp75

    Could you please let us know if you are on the latest version of WordPress 5.9.1, Yoast SEO for WordPress 18.3, and are meeting the necessary plugin requirements?

    Could you also provide us with more information where you are seeing this error message appear and how to reproduce it?

    Often, we see problems occur in combination with another plugin or theme. The fastest way to rule out any conflict, is to deactivate all non-Yoast plugins and switch to a standard theme like Twenty Twenty.

    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

    Thread Starter Kevin Pirnie

    (@kevp75)

    @mikes41720 The issue at hand is there is no check on the variable $crumbs, it is simply assumed it will always be an array, where in my cases, it was actually a boolean value of false.

    Yes, I tested with Yoast SEO as the only plugin, on TwentyTwentyTwo theme.

    Core: 5.9.1
    Yoast SEO: 18.3
    PHP: 8.0

    Understand, this does not happen in PHP 7.4 in any circumstance, it appears to be an issue with 8.0+ only.

    The fix I recommended in the OP does do the trick, however, it is likely a better idea to check if $crumbs is indeed an array before the return of the method, and if it’s not just dump out of the method or return and empty array

    @kevp75

    Based on the information you provided, we expect this to be a bug. We’re actively using the bug tracking on our GitHub repository so your best next step would be to create a new issue for our developers here.

    You will need an account to create a new issue. Please provide as much information about the issue and don’t forget to include the URL to this conversation in your report. If you have not submitted an issue previously, this guide will help you submit a complete report which may result in a faster resolution.`

    Hi all,

    This thread has been marked as resolved due to the lack of activity by the original poster.

    If you are not the original poster but have a similar issue, please open a new request.

    Thread Starter Kevin Pirnie

    (@kevp75)

    Thanks Jeroen, I figured it was implied 😉
    Yes, it can be marked resolved, there is an “issue” thread in your git repo addressing the issue.

    Happy to hear that the conversation is ongoing! Have a great day!

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘Fatal Error On breadcrumbs-generator.php with PHP 8’ is closed to new replies.