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

WordPress Trac noreply at wordpress.org
Sun Mar 21 19:35:26 UTC 2021


#52826: New wp_getimagesize() causing unexpected failures
-------------------------------------------------+-------------------------
 Reporter:  terriann                             |       Owner:  whyisjake
     Type:  defect (bug)                         |      Status:  reopened
 Priority:  normal                               |   Milestone:  5.7.1
Component:  Media                                |     Version:  5.7
 Severity:  critical                             |  Resolution:
 Keywords:  has-patch commit fixed-major needs-  |     Focuses:
  refresh                                        |
-------------------------------------------------+-------------------------
Changes (by RogerTheriault):

 * keywords:  has-patch commit fixed-major => has-patch commit fixed-major
     needs-refresh


Comment:

 As @rinatkhaziev noted above, the current patch is not fixing the original
 issue (with the calls that had just one argument).

 That is because the PHP function getimagesize is difficult to wrap:
 - the second parameter is passed by reference, and also optional
 - the source code uses [https://github.com/php/php-
 src/blob/PHP-7.4.17/ext/standard/image.c#L1504 argument counting] to
 determine the presence of the 2nd argument
 - when the second argument is passed, and a JPEG is involved, the
 underlying source code executes different code internally
 [https://github.com/php/php-src/blob/PHP-7.4.17/ext/standard/image.c#L1403
 here] and then [https://github.com/php/php-
 src/blob/PHP-7.4.17/ext/standard/image.c#L533 here] so it's important to
 avoid changing what actually executes

 To match the signature, and the intent of the existing calls, the wrapper
 here will need to conditionally call with one or two parameters, as in
 attachment:trac-52826.diff

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


More information about the wp-trac mailing list