[wp-trac] [WordPress Trac] #64742: PHP 8.5: Incorrect array access in `wp_get_attachment_image_src`
WordPress Trac
noreply at wordpress.org
Wed Mar 25 13:52:29 UTC 2026
#64742: PHP 8.5: Incorrect array access in `wp_get_attachment_image_src`
--------------------------------------+--------------------------------
Reporter: edent | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: 7.0.1
Component: General | Version: 4.4
Severity: minor | Resolution:
Keywords: good-first-bug has-patch | Focuses: php-compatibility
--------------------------------------+--------------------------------
Comment (by ozgursar):
== Patch Testing Report
Patch Tested: https://github.com/WordPress/wordpress-develop/pull/11073
=== Environment
- WordPress: 7.0-RC1-62111-src
- PHP: 8.5.4
- Server: nginx/1.29.4
- Database: mysqli (Server: 8.4.7 / Client: mysqlnd 8.5.4)
- Browser: Chrome 145.0.0.0
- OS: macOS
- Theme: Twenty Twenty-Five 1.4
- MU Plugins: None activated
- Plugins:
* Code Snippets 3.9.5
* Test Reports 1.2.1
=== Steps taken
1. Create a new post and add a featured image to it
2. Edit that post and note the `post id` from the URL (e.g /wp-
admin/post.php?post=42&action=edit)
3. To simulate the ''non-existing'' thumbnail scenario add the following
snippet to active theme's `functions.php` or via Code Snippets plugin to
set the featured image to a non existing media id.
{{{
add_action( 'init', function() {
// Replace 42 with your your post ID that you noted in Step 2.
// 999999 is the non-existing media ID
update_post_meta( 42, '_thumbnail_id', 999999 );
} );
}}}
4. Visit the following URL, replacing the `YOUR_POST_URL` with your test
post's actual URL. Example:
{{{
http://localhost:8889/wp-
json/oembed/1.0/embed?url=YOUR_POST_URL/&format=xml
}}}
5. Observe the `PHP Warning: Cannot use bool as array in /var/www/src/wp-
includes/embed.php on line 742` error in `debug.log` as well as in the
browser.
6. Apply the patch and repeat the steps 4-5.
7. ✅ Patch is solving the problem
=== Expected result
- A valid XML oEmbed response is returned even when the thumbnail doesn't
exist.
=== Screenshots/Screencast with results
Before
[[Image(https://i.imgur.com/nU1z2No.png)]]
After
[[Image(https://i.imgur.com/5yz0mQd.png)]]
--
Ticket URL: <https://core.trac.wordpress.org/ticket/64742#comment:7>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list