Make WordPress Core

Opened 4 years ago

Last modified 14 months ago

#51667 new defect (bug)

php notices in logs

Reported by: lsamins's profile lsamins Owned by:
Milestone: Awaiting Review Priority: normal
Severity: minor Version: 5.5.1
Component: Media Keywords: reporter-feedback
Focuses: Cc:

Description

On php 7.4 I receive php notices in the error log. Not really sure if its a theme problem or problem with the media.php. Just reporting in case its something that should be addressed. But my log is riddled full of these. Maybe add a check to see if the parameter is actually an array first?

[29-Oct-2020 19:20:36 UTC] PHP Notice: Trying to access array offset on value of type bool in wp-includes/media.php on line 782
[29-Oct-2020 19:20:36 UTC] PHP Notice: Trying to access array offset on value of type bool in wp-includes/media.php on line 788
[28-Oct-2020 23:11:32 UTC] PHP Notice: Trying to access array offset on value of type bool in wp-includes/media.php on line 781
[28-Oct-2020 23:11:32 UTC] PHP Notice: Trying to access array offset on value of type bool in wp-includes/media.php on line 787

Change History (3)

#1 @sabernhardt
4 years ago

  • Component changed from General to Media

@lsamins Thanks for the report!

Lines 781 to 788 would involve a $data array created within the image_get_intermediate_size function.

This has been fixed in at least one plugin so far:
https://wordpress.org/support/topic/error-trying-to-access-array-offset-on-value-of-type-bool-in-block-php-line-297/

Can you determine whether a certain plugin is causing these errors?

#2 @lsamins
4 years ago

I did a search for image_get_intermediate_size on my plugin folder and found class-wc-regnerate-images.php and class.photon.php reference that keyword. The first one is a woo commerce include file. the second one is a file related to the jetpack plugin.

I disabled the jet pack plugin and continue to see the same errors in my log file. I cant disable woocommerce without taking my store down.

When I set up some logging for the imagedata variable, the array had some empty items at the end. I believe this is causing $data to be empty and not an array, thus the notice. It doesn't seem to have any negative impact on the site itself that I can see. Adding a check to see if $data is an array causes the errors to stop. But I'm unable to pinpoint if the erroneous data is due to a plugin or maybe even a meta data issue of some sort in the database.

#3 @antpb
14 months ago

  • Keywords reporter-feedback added

hi @lsamins ! Are you still having to work around this? Where was it that you did the array check to bypass the error?

Note: See TracTickets for help on using tickets.