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

WordPress Trac noreply at wordpress.org
Mon Nov 24 13:02:34 UTC 2025


#64295: PHP 8.5: Incorrect array access in `wp_read_image_metadata`
-------------------------------------------+-------------------------------
 Reporter:  swissspidy                     |       Owner:  (none)
     Type:  defect (bug)                   |      Status:  new
 Priority:  normal                         |   Milestone:  6.9
Component:  Media                          |     Version:
 Severity:  normal                         |  Resolution:
 Keywords:  has-patch php85 needs-testing  |     Focuses:  php-
                                           |  compatibility
-------------------------------------------+-------------------------------

Comment (by palak678):

 I ran a quick test using WordPress 6.8.3 with PHP 8.4, and tried uploading
 a corrupted JPEG file to reproduce the behavior described in this ticket.

 Here’s what I found:

 getimagesize() throws warnings about corrupted JPEG data

 exif_read_data() also reports corruption (invalid COM section, broken
 structure, etc.)

 No fatal errors, but the metadata handling definitely breaks in the same
 way mentioned in the ticket

 Log output for reference:

 PHP Warning:  getimagesize(): Corrupt JPEG data: 138 extraneous bytes
 before marker
 PHP Notice:   exif_read_data(): Image has corrupt COM section: wrong
 length information
 PHP Warning:  exif_read_data(): File structure corrupted
 PHP Warning:  exif_read_data(): Invalid JPEG file

 So the issue is definitely reproducible on PHP 8.4.
 The ticket still needs a patch to prevent array-access warnings when
 wp_getimagesize() returns false.

 Happy to re-test once a patch is available!

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


More information about the wp-trac mailing list