Make WordPress Core

Opened 7 months ago

Last modified 4 months ago

#61717 new defect (bug)

Warning: Trying to access array offset on value of type bool in /sites/site.com/wp-includes/media.php on line 795 801

Reported by: vladte4's profile vladte4 Owned by:
Milestone: Awaiting Review Priority: normal
Severity: major Version: 6.3.1
Component: Media Keywords: has-patch reporter-feedback needs-testing-info
Focuses: coding-standards Cc:

Description

Hello! Maybe someone knows what the problem is? Photo files avif.
https://i.ibb.co/gTFqdW5/photo-2024-07-20-16-12-13.jpg
https://i.ibb.co/KqsDJ7N/2024-07-20-161310.png
https://i.ibb.co/RTLc6q2/f5n91e6t.png

It seems to me that the error began to appear after updating the WordPress. I tried regenerate thumbnails but it didn't work for me. I disabled all plugins and left only WooCommerce, WPBakery, Woodmart Core.

Change History (17)

#1 @jrf
7 months ago

  • Focuses performance php-compatibility removed

#2 @vladte4
7 months ago

https://i.ibb.co/pwnPLDW/2024-07-21-040023.png

a little more information. I installed ubuntu 22.04 on a new server, but the error remained, so I think it's in WordPress 6.6

#3 @vladte4
7 months ago

The photo had a size of 1920x1920 . Everything is fine with 800x800 resolution. Photos with the webp extension also break. Photos in 790x796 wepb resolution are also broken. JPG also broken. For me, only photos with a size of 800x800 started working properly. The problem remained on php 8.3

Last edited 7 months ago by vladte4 (previous) (diff)

#4 @vladte4
7 months ago

  • Keywords needs-patch added

I can provide access to the server so that you can view the error, I have a test site

This ticket was mentioned in Slack in #core-media by antpb. View the logs.


7 months ago

#6 @antpb
7 months ago

  • Keywords reporter-feedback added

We've seen recent reports similar to this issue (example: #59573) It might be worth adding a bool check to be safe here and avoid future reports. It would be nice to understand more what value is being passed through here to better understand why we are making the change.

@vladte4 thanks for this report and all the info! One thing we are still lacking to diagnose the issue is the call stack that is resulting in the error. Is there any way that you can share with us the calls that are triggering the warning? Knowing if it is a theme or plugin, a certain function, or any other information about where its coming from would be very helpful. I'd like to better understand how a bool is getting to this point in the code so we can bypass this logic in the case of a bool.

#7 @vladte4
7 months ago

The error was in the WPBakery plugin, you need to update to version 7.8 . After the update, the error seems to have disappeared and everything is fine

#8 @vladte4
7 months ago

Hello! The error remains, the update did not help :(

#9 @niravsherasiya7707
7 months ago

@vladte4 Could you please mention the steps to recreate it?

#10 @vladte4
7 months ago

I deleted the data for access to the site

Last edited 6 months ago by vladte4 (previous) (diff)

#11 @vladte4
7 months ago

@niravsherasiya7707 @antpb Here are the data to the server and the website. The error is visible in the product and on the main page. The site has just started to be developed, so you can install plugins for diagnostics and more

#12 @vladte4
6 months ago

If anyone has time, can you review it? I disabled all plugins and activated the standard theme, but the error remains. I left only WooCommerce. Also, the error is sometimes displayed in the panel when adding a photo to a product or updating a product. Exactly Avif file

#13 @vladte4
6 months ago

  • Keywords reporter-feedback removed

#14 @vladte4
6 months ago

I disabled the error. With this code. I don't know when the problem will be solved, this post is no longer viewed, so for now

ini_set('display_errors', 'Off'); 
ini_set('error_reporting', E_ALL);

This ticket was mentioned in PR #7221 on WordPress/wordpress-develop by @narenin.


6 months ago
#15

  • Keywords has-patch added; needs-patch removed

@hellofromTonya commented on PR #7221:


4 months ago
#16

Hello @narenin, Thank you for this patch. In reviewing it, I don't think this is the way to fix the issue. Why?

  1. The root cause is not yet known.
  2. The Warning may be appropriate as is the indicator to developers and contributors that something upstream of this function is wrong.

Please note, this part of the function requires both the width and height, meaning they should both always be in the array. One or both not being in the array could mean there's an issue upstream before this function gets called. That's where the fix IMO should happen.

What about adding defensive guard? Yes, can be good, but should still alert developers and contributors (throw an error, doing it wrong, etc.).

This assumes both the width and height (as the code is now) are required and should always be there. Maybe @antpb can share some thoughts.

#17 @hellofromTonya
4 months ago

  • Keywords reporter-feedback needs-testing-info added
  • Version changed from 6.6 to 6.3.1

Hello @vladte4,

Welcome to WordPress Core's Trac.

As @antpb noted, #59573 was a similar report. Setting the Version (the WP version that may have introduced the bug) to match #59573.

I don't think this ticket is actionable yet. What does it need? As @antpb noted in comment:6:

  • Step-by-step instructions for how to reproduce the issue.
  • The call stack that accompanies the Warning posted.

These will give contributors the starting point to produce and investigate to identify the root cause.

I suspect the root cause may be upstream, i.e. before the image_get_intermediate_size() function runs. While defensive guards can be added to image_get_intermediate_size(), they will not resolve an upstream bug.

Updating the ticket Version and keywords to help denote current state.

Note: See TracTickets for help on using tickets.