• Resolved gbotica

    (@gbotica)


    I have a site with Yoast SEO (21.5) which is getting fatal errors when I try running PHP 8.0 or 8.1. PHP 7.4 works fine. Also, if I switch to PHP 8.1 and deactivate Yoast SEO, also the site works fine.

    I’ve also tried switching to a default theme 2020, and still the issue occurs, so it can’t be a custom theme issue either.

    Error in the log is:

    [13-Nov-2023 01:03:08 UTC] PHP Fatal error: Uncaught TypeError: array_key_exists(): Argument #2 ($array) must be of type array, bool given in /sites/XXXXXX/files/public/wp-content/plugins/wordpress-seo/src/helpers/pagination-helper.php:77

    Weird thing is I have many other sites using PHP 8.1 and Yoast SEO, but haven’t had this problem before.

    Any help, advice or assistance appreciated! Thanks.

Viewing 8 replies - 1 through 8 (of 8 total)
  • Thread Starter gbotica

    (@gbotica)

    I’ve also just tested with all plugins, except WooCommerce and Yoast SEO activated… still get the same error. WP core 6.4.1.

    [13-Nov-2023 01:14:58 UTC] PHP Fatal error: Uncaught TypeError: array_key_exists(): Argument #2 ($array) must be of type array, bool given in /sites/XXXXX/files/public/wp-content/plugins/wordpress-seo/src/helpers/pagination-helper.php:77

    Thread Starter gbotica

    (@gbotica)

    Previous post should read “I’ve also just tested with all plugins (except WooCommerce and Yoast SEO) deactivated.

    Plugin Support Maybellyne

    (@maybellyne)

    Hello @gbotica

    I’m sorry about the PHP fatal error you encountered. To confirm, is the error specifically thrown when you visit a certain page on the website?

    Thread Starter gbotica

    (@gbotica)

    Hi, thank you for your response. In the case I have now, the fatal error occurs when viewing a WooCommerce product category page, with more than a single page of results. If I view a product category with # of products that is less than the setting for # products per page, then the page loads OK.

    As soon as I view a page where the products require greater than 1 page (i.e. pagination is required), then I get the fatal error.

    Hopefully that makes some sense and I’m curious to hear if you can recreate the problem.

    Thanks for your input.

    Plugin Support Maybellyne

    (@maybellyne)

    I tried to replicate the setup you described – a product category with many products, thereby giving a paginated series. I navigated across the series (/page/2, /page/3, etc) and didn’t notice any errors. I’m on PHP 8.2.9, though.

    Is there something peculiar to the setup where you experience the issue compared to the other sites where there are no errors? What if you upgrade to a PHP version higher than what you already tested?

    Thread Starter gbotica

    (@gbotica)

    Hi, Thank you very much for your time in testing this issue and providing input. Today I have just retested and while I initially got some 500 errors, it now seems to be working OK. I suspect it may have been an issue with the object cache, though even a server restart didn’t resolve it. I think disabling the object cache and then re-activating seems to have done the trick. I also used WP-CLI and ran wp cache flush.

    So, it appears this issue is resolved. Thanks again for your help.

    Thread Starter gbotica

    (@gbotica)

    Marking as resolved

    Ben

    (@runpixelrun)

    G’day. Am seeing this same issue on a regular basis. It does indeed seem that clearing the object cache resolves it, but having the fatal error thrown to our customers so often is less than ideal. Is there a way to resolve it? Seems it receives a boolean instead of an array, and not sure why.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Fatal error with PHP 8.0 / 8.1’ is closed to new replies.