[wp-trac] [WordPress Trac] #39552: SVG upload support broken in 4.7.1

WordPress Trac noreply at wordpress.org
Thu Jan 19 18:40:58 UTC 2017


#39552: SVG upload support broken in 4.7.1
----------------------------------------+----------------------
 Reporter:  freakpants                  |       Owner:
     Type:  defect (bug)                |      Status:  closed
 Priority:  normal                      |   Milestone:  4.7.2
Component:  Upload                      |     Version:  trunk
 Severity:  normal                      |  Resolution:  invalid
 Keywords:  needs-unit-tests has-patch  |     Focuses:
----------------------------------------+----------------------

Comment (by freakpants):

 Replying to [comment:17 LewisCowles]:
 > Although mildly troubling the simple check; there is actually no break
 from WP core

 Sure it is. The function that was introduced is supposed to accurately
 return the mime type of the file uploaded. What it currently does is
 return a wrong mimetype for SVG (and possible other unknown image types).
 Fixing that would NOT reenable SVG support in Core (that still needs the
 add_filter( 'upload_mimes') workaround). This update '''actively broke'''
 that functionality by returning the wrong mimetype.

 Also, the PHP Documentation actively discourages to validate images this
 way. Fileinfo (which is already being used in the same core file right now
 anyway) is the superior way to determine mimetype either way.

 http://php.net/manual/en/function.getimagesize.php
 "Do not use getimagesize() to check that a given file is a valid image.
 Use a purpose-built solution such as the Fileinfo extension instead."

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


More information about the wp-trac mailing list