#59573 closed defect (bug) (maybelater)
warning: trying to access array offset on value of type bool in wp-includes/media.php
Reported by: | androidforlife | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 6.3.1 |
Component: | Media | Keywords: | reporter-feedback |
Focuses: | Cc: |
Description (last modified by )
function image_get_intermediate_size($post_id, $size = 'thumbnail') { $imagedata = wp_get_attachment_metadata($post_id); // Checking whether $imagedata and $imagedata['sizes'] are real arrays. if (!is_array($imagedata) || empty($imagedata['sizes']) || !is_array($imagedata['sizes'])) { return false; } // Checking whether $size has a valid structure. if (!is_array($size) || count($size) < 2) { return false; } $data = [];
.....
Change History (7)
#1
@
13 months ago
- Component changed from General to Media
- Description modified (diff)
- Summary changed from warning: trying to access array offset on value of type bool in wp-incloudes/media.php to warning: trying to access array offset on value of type bool in wp-includes/media.php
This ticket was mentioned in Slack in #core-media by antpb. View the logs.
8 months ago
#3
@
8 months ago
- Milestone Awaiting Review deleted
- Resolution set to invalid
- Status changed from new to closed
#4
@
8 months ago
- Keywords reporter-feedback added
- Milestone set to Awaiting Review
- Resolution invalid deleted
- Status changed from closed to reopened
I expect the code in the description suggested a revision. The original comments were in German.
The $size
condition is still flawed because that parameter can be a string (and is 'thumbnail' by default).
@androidforlife I should have asked for a PHP stack trace months ago to know what caused the error. Do you have a way to reproduce it now?
This ticket was mentioned in Slack in #core-media by joedolson. View the logs.
5 months ago
#6
@
5 months ago
- Milestone Awaiting Review deleted
- Resolution set to maybelater
- Status changed from reopened to closed
The code may be a suggested revision, but it's not a good suggestion; the current code handles a string value better than that does, which would result in executing count()
on a non-countable variable type.
Without any context on where this is coming from, I don't think there's any action we can take on this ticket.
If @androidforlife is able to provide a stack trace that tells us what to look at, we can re-open this, but I don't think it's productive to keep it open for now.
Where did that code come from? That's not code from any even moderately recent version of WordPress. If you're using an older version of WordPress, then you need to start by updating to the latest release.