Bug #79325 [Com]: MIME type of MP3s over 50MB is incorrect
| From: | daverandom@php.net | Date: | Sat, 29 Feb 2020 20:04:12 +0000 |
| Subject: | Bug #79325 [Com]: MIME type of MP3s over 50MB is incorrect | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-225808@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=79325&edit=1
ID: 79325
Comment by: daverandom@php.net
Reported by: michael at beorn dot me
Summary: MIME type of MP3s over 50MB is incorrect
Status: Feedback
Type: Bug
Package: Filesystem function related
Operating System: macOS, Ubuntu
PHP Version: 7.4.3
Block user comment: N
Private report: N
New Comment:
Side note to anyone who happens to be passing with admin access to bugsnet, the fileinfo extension
seems to be missing from the package list (or possibly I am just blind)
Previous Comments:
------------------------------------------------------------------------
[2020-02-29 20:02:44] daverandom@php.net
I cannot reproduce this on any version or platform including 7.4.3 ubuntu as specified above, I
don't have OSX available to test.
As a rule the total size of the file should have no impact here as these functions do not generally
do anything other than looking at a small number of bytes from the start of the file - are you
certain that the >50MB file(s) you have tested are correctly encoded? Can you verify whether
anything else that wraps libmagic is able to correctly identify them? I'm wondering if this is
an upstream problem, or possibly a broken magic.mime definition file.
If you are able to provide a sample MP3 file that causes the problem I will investigate further,
though I realise this may not be possible.
------------------------------------------------------------------------
[2020-02-29 18:48:45] michael at beorn dot me
Description:
------------
---
From manual page: https://php.net/function.mime-content-type
---
An MP3 file over 50,000,000 bytes (50 MB base-10) is reported to have a MIME type of
âapplication/octet-streamâ instead of the correct âaudio/mpegâ:
Test script:
---------------
echo mime_content_type('test-over-50mb.mp3') . " > " .
filesize('test-over-50mb.mp3');
application/octet-stream > 50030096
echo mime_content_type(âtest-under-50mb.mp3') . " > " .
filesize(âtest-under-50mb.mp3');
audio/mpeg > 49730577
Expected result:
----------------
The expected result is that an MP3 audio file over 50MB is reported as having a MIME type of
"audio/mpeg".
Actual result:
--------------
An MP3 file over 50,000,000 bytes (50 MB base-10) is reported to have a MIME type of
âapplication/octet-streamâ.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=79325&edit=1