[wp-trac] [WordPress Trac] #52826: New wp_getimagesize() causing unexpected failures

WordPress Trac noreply at wordpress.org
Tue Mar 16 15:58:18 UTC 2021


#52826: New wp_getimagesize() causing unexpected failures
--------------------------+-----------------------------
 Reporter:  terriann      |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Media         |    Version:  5.7
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 The new function `wp_getimagesize()` introduced in WordPress 5.7 is
 causing JPEG images that have more than a basic amount of EXIF data to
 return false where the previous implementation using `getimagesize()`
 returned a valid array.

 The function was introduced in #49889 and forces passing a second
 parameter that the `getimagesize()` function expects as a reference, which
 impacts the actual behavior - previously, most calls did not pass the 2nd
 param, and internally, PHP executes different code now because an array
 ref is passed. In addition, the array is discarded because it wasn’t
 passed from the WordPress code.

 The second parameter is also noted as only supporting JFIF files.
 https://www.php.net/manual/en/function.getimagesize.php

 Because the second parameter for `getimagesize()` is passed by reference,
 only passing that second parameter when on has been provided to
 `wp_getimagesize()` would be preferable.

 I've seen at least one customer report of this issue where the size data
 comes back as false where it was previously working, manifesting in
 problems with cropping images and missing information in the attachment
 metadata.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/52826>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list