[wp-trac] [WordPress Trac] #64742: PHP 8.5: Incorrect array access in `wp_get_attachment_image_src`

WordPress Trac noreply at wordpress.org
Fri Mar 27 06:10:22 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 has-unit-   |     Focuses:  php-
  tests                                          |  compatibility
-------------------------------------------------+-------------------------

Comment (by roshniahuja14):

 I've submitted a pull request for this issue: https://github.com/WordPress
 /wordpress-develop/pull/11365

   Changes:
   - Added is_array() guards before list() destructuring of
 wp_get_attachment_image_src() return value in
 get_oembed_response_data_rich(), wp_playlist_shortcode(), and
 wp_prepare_attachment_for_js()
   - Guarded wp_getimagesize() return inside wp_get_attachment_image_src()
 itself
   - Added unit tests covering invalid thumbnail ID scenarios

   Testing:
   - All existing PHPUnit tests pass (430 tests in Media + oEmbed suites)
   - Manually verified: set _thumbnail_id to a non-existent ID, visited the
 oEmbed endpoint — no PHP warnings, thumbnail keys are cleanly omitted from
 the response

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/64742#comment:11>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list