Support » Fixing WordPress » PHP error “trying to access array offset”

  • Resolved fhwebdesign

    (@fhwebdesign)


    Hi there,

    I just noticed the following error in my apache log:
    [26-Jan-2022 14:02:05] WARNING: [pool xxx] child 774611 said into stderr: “PHP message: PHP Warning: Trying to access array offset on value of type bool in /xxx/wp-includes/media.php on line 785”
    Also, there the same erro message for other lines.

    So I cloned my website, deactivated all plugins, switched theme to twenty twentytwo and tried again.
    The error still persists.

    As I am using Plesk with WP-Toolkit extension, I used that to verify the checksums of the wordpress and verify their integrity. The checksums are correct.

    So I used WP-Toolkit to reinstall the wordpress core. It has done without any errors.
    But still, the warning above exists.

    A completely new WordPress installation does not throw this warning.

    Any ideas what I can check further?

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

    (@berksted)

    Hi,

    A PHP warning message like will not break the site but there is some code doing something unapproved (i.e. not checking for the existence of a value).

    What version of PHP are you using and is there any difference between the two systems? A newer version maybe more strict.

    Ben

    • This reply was modified 2 years ago by benjamin.
    Thread Starter fhwebdesign

    (@fhwebdesign)

    Hi @berksted ,
    thanks for your answer.
    I know it won’t do anything worse – but I want my logs clean, not growing and easier for real error investigation.

    I’m using PHP 8.0 on both sites, they are hosted on the same server.

    benjamin

    (@berksted)

    Hi,

    Right now php 8 is in beta support, so that might be the issue.

    https://make.wordpress.org/core/handbook/references/php-compatibility-and-wordpress-versions/

    You can turn off those notifications for the time being ( I know this is not the optimal solution).

    https://www.php.net/manual/en/function.error-reporting.php

    ben

    Thread Starter fhwebdesign

    (@fhwebdesign)

    Hi,
    seems like that is the solution.
    With PHP7.4, the warning is not shown.
    Thanks!

    PS: I wonder why the fresh installation of WP with PHP 8.0 is not running into this warning…

    benjamin

    (@berksted)

    Hi,

    Hmmm… not sure, do you have the content/images loaded in the fresh install? In that part of the code, it’s trying to fetch an image.

    Ben

    Thread Starter fhwebdesign

    (@fhwebdesign)

    No, there are no images and pages/posts loaded.
    Maybe there could be the problem. But how do I detect the detailled problem?

    benjamin

    (@berksted)

    Hi,

    Updated. Might be best to file a bug report as that line (785) is not handling the operation correctly.

    Ben

    • This reply was modified 2 years ago by benjamin.
    • This reply was modified 2 years ago by benjamin.
    • This reply was modified 2 years ago by benjamin.
Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘PHP error “trying to access array offset”’ is closed to new replies.