[wp-trac] [WordPress Trac] #39550: Some Non-image files fail to upload after 4.7.1

WordPress Trac noreply at wordpress.org
Tue Feb 28 05:53:53 UTC 2017


#39550: Some Non-image files fail to upload after 4.7.1
---------------------------+------------------------
 Reporter:  greatislander  |       Owner:  joemcgill
     Type:  defect (bug)   |      Status:  closed
 Priority:  normal         |   Milestone:  4.7.3
Component:  Upload         |     Version:  4.7.1
 Severity:  critical       |  Resolution:  fixed
 Keywords:  fixed-major    |     Focuses:
---------------------------+------------------------

Comment (by Blue Liquid Designs):

 Just an educated assumption, but there's likely going to be edge cases
 between environments that will cause incorrect mime type issues when using
 the default PHP magic database with `finfo_open`.

 This is based on the `finfo_open` PHP docs including a warning about mime
 type format changes in PHP 5.3.11 and 5.4.1:

 > Warning
 > The expected magic database format changed in PHP 5.3.11 and 5.4.1. Due
 to this, the internal magic database was upgraded. This mostly effects
 code where an external magic database is used: reading an older magic file
 will now fail. Also, some textual representations of the mime types has
 changed, for instance for PHP would be "PHP script, ASCII text" instead of
 "PHP script text" returned.

 To get around this problem, it might be worth considering shipping
 WordPress with it's own magic database and passing that to parameter two
 of `finfo_open`. This is exactly what
 [https://www.drupal.org/project/mimedetect Drupal 7 does with their
 MimeDetect module and FileField].

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


More information about the wp-trac mailing list