[wp-trac] [WordPress Trac] #53121: wp_get_image_mime() - something weird going on

WordPress Trac noreply at wordpress.org
Fri Apr 30 18:45:20 UTC 2021


#53121: wp_get_image_mime() - something weird going on
--------------------------+------------------------------
 Reporter:  jrf           |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Media         |     Version:  4.8
 Severity:  minor         |  Resolution:
 Keywords:                |     Focuses:
--------------------------+------------------------------

Comment (by joemcgill):

 Hi @jrf! I don't know that I can remember all the details here, though I
 believe the reasons that these are inconsistent is that prior to [39831],
 WP relied entirely on `getimagesize` and include the `function_exists()`
 check. If I remember correctly, we introduced the `exif_imagetype()` check
 because it is more performant but wanted to keep the previous behavior as
 a fallback. The reason those checks are different are most likely because
 I personally prefer `is_callable()` but am also often overly conservative
 about changing previous behavior and opted not to update the check for
 `getimagesize`. So, the answer is probably that humans are strangely
 inconsistent at times 😀. Hope this helps!

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


More information about the wp-trac mailing list