|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2019-03-23 10:29 UTC] dpoddubny at gmail dot com
Description: ------------ Hello. Starting from php 7.3.2 function mime_content_type doubles the result for xlsx files created in LibreOffice (6.0.7.3). While php 7.3.1 works correctly. Test script: --------------- How to reproduce: 1. git clone https://github.com/karser/php_bug_mime_content_type_doubles_result 2. Build the image and see the bug: docker build --no-cache --build-arg PHP_VER=7.3.2 . Step 5/5 : RUN php -r "var_dump(mime_content_type('/test.xlsx'));" ---> Running in 71f6655ae0ed string(130) "application/vnd.openxmlformats-officedocument.spreadsheetml.sheetapplication/vnd.openxmlformats-officedocument.spreadsheetml.sheet" docker build --no-cache --build-arg PHP_VER=7.3.1 . Step 5/5 : RUN php -r "var_dump(mime_content_type('/test.xlsx'));" ---> Running in 27e744a45920 string(65) "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" Expected result: ---------------- mime_content_type('/test.xlsx') returns "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" Actual result: -------------- mime_content_type('/test.xlsx') returns "application/vnd.openxmlformats-officedocument.spreadsheetml.sheetapplication/vnd.openxmlformats-officedocument.spreadsheetml.sheet" PatchesPull Requests
Pull requests:
HistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 16:00:01 2025 UTC |
This also is affecting word documents. Tested with: - MAC OS 10.15.4/ PHP 7.3.4 - Ubuntu 16.04.6 LTS / PHP 7.3.13 - Ubuntu 16.04.6 LTS / PHP 7.3.14 $ file --mime-type test.docx test.docx: application/vnd.openxmlformats-officedocument.wordprocessingml.document $ php -a Interactive shell php > print mime_content_type('./test.docx'); application/vnd.openxmlformats-officedocument.wordprocessingml.documentapplication/vnd.openxmlformats-officedocument.wordprocessingml.documentEncountered this using PHP 7.4.19 both inside a docker container and 7.3 (don't have more specific info) on the Pantheon hosting platform. Confirmed that the mime type returned by $finfo = finfo_open( FILEINFO_MIME_TYPE ); $real_mime = finfo_file( $finfo, $file ); is `application/vnd.openxmlformats-officedocument.wordprocessingml.documentapplication/vnd.openxmlformats-officedocument.wordprocessingml.document` for a docx file that was exported from Google Drive. This problem did not occur with a docx file created in LibreOffice.