php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #77784 mime_content_type result gets doubled for xlsx
Submitted: 2019-03-23 10:29 UTC Modified: 2019-04-17 15:42 UTC
Votes:27
Avg. Score:4.5 ± 0.7
Reproduced:27 of 27 (100.0%)
Same Version:9 (33.3%)
Same OS:21 (77.8%)
From: dpoddubny at gmail dot com Assigned:
Status: Verified Package: Filesystem function related
PHP Version: 7.3.3 OS: linux
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [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"

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2019-04-17 15:42 UTC] cmb@php.net
-Status: Open +Status: Verified
 [2019-04-17 15:42 UTC] cmb@php.net
I can reproduce this with the provided .xlsx, but not with
arbitrary LibreOffice .xlsx files.  The behavioral change is most
likely caused by the upgrade to 5.34[1].

[1] <http://git.php.net/?p=php-src.git;a=commit;h=d874d4a15c2e17a753d580691906c95e9153b823>
 [2019-04-23 08:51 UTC] hrvoje dot novosel at gmail dot com
Just to add another note, I've hit this issue today with php 7.3.4
I've also tried resaving the xlsx with LibreOffice 6.1.5.2 (x64) and after that I get application/octet-stream as function return.
 [2019-12-06 10:23 UTC] krihog at gmail dot com
Encountered this issue a couple of days ago when trying an upgrade to PHP 7.4.0
With xlsx-files downloaded from Google Sheets.
 [2020-01-07 14:54 UTC] albsmul at gmail dot com
Same problem with php 7.4.1 and a Word docx file (libmagic 537) - mime_content_type returns "application/vnd.openxmlformats-officedocument.wordprocessingml.documentapplication/vnd.openxmlformats-officedocument.wordprocessingml.document"

Worked well on old php 5.6.26 (libmagic 517)
 [2020-03-13 10:26 UTC] mcorteel at yahoo dot fr
Same problem with LibreOffice 6.0.7.3 and PHP 7.4.2.
Mimetype: application/vnd.openxmlformats-officedocument.spreadsheetml.sheetapplication/vnd.openxmlformats-officedocument.spreadsheetml.sheet
 [2020-03-26 12:45 UTC] willem at soomedia dot nl
I'm experiencing the same issue in my Docker container with PHP version 7.3.11.
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Mon Mar 30 08:01:26 2020 UTC