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

WordPress Trac noreply at wordpress.org
Thu Mar 18 17:33:46 UTC 2021


#52826: New wp_getimagesize() causing unexpected failures
-------------------------------------+---------------------
 Reporter:  terriann                 |       Owner:  (none)
     Type:  defect (bug)             |      Status:  new
 Priority:  normal                   |   Milestone:  5.7.1
Component:  Media                    |     Version:  5.7
 Severity:  critical                 |  Resolution:
 Keywords:  has-patch needs-testing  |     Focuses:
-------------------------------------+---------------------

Comment (by rinatkhaziev):

 @Mista-Flo

   Furthermore, it doesn't require to add extra condition to check if it's
 null or not.

 Unfortunately, that's not true according to our testing.

 With your version of the patch:

 {{{#!php
 <?php
 # wp post meta get 15 _wp_attachment_metadata
 array (
   'filesize' => 1460536,
 )
 }}}

 With @terriann's:

 {{{#!php
 <?php
 # wp post meta get 16 _wp_attachment_metadata
 array (
   'width' => 1333,
   'height' => 2000,
   'file' => '2021/03/has-exif-4.jpg',
   'sizes' =>
   array (
   ),
   'image_meta' =>
   array (
     'aperture' => '0',
     'credit' => '',
     'camera' => '',
     'caption' => '',
     'created_timestamp' => '0',
     'copyright' => '',
     'focal_length' => '0',
     'iso' => '0',
     'shutter_speed' => '0',
     'title' => '',
     'orientation' => '0',
     'keywords' =>
     array (
     ),
   ),
   'filesize' => 1460536,
 )
 }}}


 **To clarify**

 The issue is only present when the following conditions are true:
 - The file in question is using a custom
 [https://www.php.net/manual/en/class.streamwrapper.php streamWrapper]
 implementation. e.g. `mycustomstream://path-to-file.jpg`
 - The file contains EXIF data

 For anyone interested, here are more links:
 - https://github.com/humanmade/S3-Uploads/issues/496
 - https://github.com/aws/aws-sdk-php/issues/1923

 We use a different Stream Wrapper but AWS is probably the easiest to use
 for testing/confirming.

 [https://github.com/php/php-
 src/blob/PHP-7.4.17/ext/standard/image.c#L473-L558 The underlying PHP
 source is likely here]

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


More information about the wp-trac mailing list