Bug #78028 [Opn->Dup]: finfo_file reports duplicate mime type for some `docx` files

From: Date: Fri, 17 May 2019 14:05:49 +0000
Subject: Bug #78028 [Opn->Dup]: finfo_file reports duplicate mime type for some `docx` files
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-220884@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=78028&edit=1 ID: 78028 Updated by: cmb@php.net Reported by: alex at buayacorp dot com Summary: finfo_file reports duplicate mime type for some docx files -Status: Open +Status: Duplicate Type: Bug Package: Filesystem function related Operating System: Debian Jessie PHP Version: 7.3.5 -Assigned To: +Assigned To: cmb Block user comment: N Private report: N New Comment: This is basically a duplicate of bug #77784. Previous Comments: ------------------------------------------------------------------------ [2019-05-17 13:39:34] alex at buayacorp dot com Description: ------------ While migrating our application from PHP 7.2 to PHP 7.3, we noticed that some docx files report a duplicate mime type. It looks like the fix committed in https://github.com/php/php-src/commit/d874d4a15c2e17a753d580691906c95e9153b823 is the one that introduces this issue, previous commits don't expose this issue. The below builds are compiled with: ./configure --disable-all --enable-fileinfo && make Switched to a new branch 'ee50461' ./sapi/cli/php ../payload.php application/vnd.openxmlformats-officedocument.wordprocessingml.document Switched to a new branch 'd874d4a' ./sapi/cli/php ../payload.php application/vnd.openxmlformats-officedocument.wordprocessingml.documentapplication/vnd.openxmlformats-officedocument.wordprocessingml.document Test script: --------------- <?php // You can grab a copy of this file in https://www.buayacorp.com/demo.docx (it's an empty Google doc file saved as "docx" format). $filename = __DIR__ . '/demo.docx'; $finfo = finfo_open(FILEINFO_MIME_TYPE); echo finfo_file($finfo, $filename).PHP_EOL; finfo_close($finfo); Expected result: ---------------- application/vnd.openxmlformats-officedocument.wordprocessingml.document Actual result: -------------- application/vnd.openxmlformats-officedocument.wordprocessingml.documentapplication/vnd.openxmlformats-officedocument.wordprocessingml.document ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=78028&edit=1

« previous php.bugs (#220884) next »