Edit report at https://bugs.php.net/bug.php?id=64462&edit=1
ID: 64462 Comment by: vitalif at mail dot ru Reported by: vitalif at mail dot ru Summary: Bug in libmagic included with fileinfo extension Status: Closed Type: Bug Package: Filesystem function related PHP Version: 5.5.0alpha5 Assigned To: ab Block user comment: N Private report: N New Comment: Thank you, it works in PHP 5.5! Previous Comments: ------------------------------------------------------------------------ [2013-04-07 20:51:19] a...@php.net Just upgraded to libmagic 5.14 in PHP 5.4+ dev branches, please test. ------------------------------------------------------------------------ [2013-03-21 12:36:02] vitalif at mail dot ru For testing you should first get any Visio document, for example this one from a public SVN repository: http://visipy.googlecode.com/svn-history/r3/trunk/test/testfile.vsd And then run <?php $o = finfo_open(); echo finfo_file($o, "testfile.vsd", FILEINFO_MIME_TYPE); The correct output will be "application/vnd.ms-office", the incorrect will be "application/msword". ------------------------------------------------------------------------ [2013-03-21 11:21:32] a...@php.net Thanks for the patch. We use libmagic 5.11 which is about one year old. You're right, it could be upgraded. Most our fixes related to it are PHP specific. It would be nice if you'd submit a testcase for this, furthermore it's essential. That will be useful now to test this patch and later after upgrade. ------------------------------------------------------------------------ [2013-03-20 12:05:41] vitalif at mail dot ru Description: ------------ Hello! First of all I want to say that libmagic included with fileinfo extension is 2 YEARS OLD and has bugs - you should UPDATE it to something like 5.13. Also it would be good if you submit your libmagic fixes to UPSTREAM (to libmagic author) - at least some of them. And also I want to tell you about a specific bug - your libmagic detects all MSOffice documents unknown to it as "application/msword". For example, any Visio (CDF) document is detected as "application/msword", which is incorrect. This bug was in libmagic 5.11, but is already fixed in 5.13. I would propose updating the included libmagic, but if you don't want to do it you can just apply a simple patch (attached). With it Visio and all other unknown files are detected as application/vnd.ms-office which is more correct. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=64462&edit=1