[wp-trac] [WordPress Trac] #11946: Ensure image MIME type matches extension

WordPress Trac noreply at wordpress.org
Wed Jan 11 13:07:56 UTC 2017

#11946: Ensure image MIME type matches extension
 Reporter:  Viper007Bond             |       Owner:  Viper007Bond
     Type:  defect (bug)             |      Status:  reopened
 Priority:  normal                   |   Milestone:  Future Release
Component:  Upload                   |     Version:  3.0
 Severity:  minor                    |  Resolution:
 Keywords:  needs-refresh has-patch  |     Focuses:

Comment (by joemcgill):

 In [changeset:"39831"]:
 #!CommitTicketReference repository="" revision="39831"
 Media: Improve image filetype checking.

 This adds a new function `wp_get_image_mime()` which is used by
 `wp_check_filetype_and_ext()` to validate image files using
 `exif_imagetype()` if available instead of `getimagesize()`.

 `getimagesize()` is less performant than `exif_imagetype()` and is
 dependent on GD. If `exif_imagetype()` is not available, it falls back to
 `getimagesize()` as before.

 If `wp_check_filetype_and_ext()` can't validate the filetype, we now
 `false` for ext/MIME values.

 See #11946.

Ticket URL: <https://core.trac.wordpress.org/ticket/11946#comment:35>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform

More information about the wp-trac mailing list