|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2021-01-05 15:17 UTC] cmb@php.net
-Status: Open
+Status: Feedback
-Assigned To:
+Assigned To: cmb
[2021-01-05 15:17 UTC] cmb@php.net
[2021-01-05 16:20 UTC] info at lauta dot media
-Status: Feedback
+Status: Closed
[2021-01-05 16:20 UTC] info at lauta dot media
[2021-01-05 16:29 UTC] cmb@php.net
-Status: Closed
+Status: Not a bug
[2021-01-05 16:29 UTC] cmb@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 07:00:01 2025 UTC |
Description: ------------ mime_content_type() and finfo reports mime type application/octet-stream for MP3 files with ID3v1 tags. ID3v1 seems to be used in up to 10% of all MP3 files which have any ID3 tags. This seems to be an issue with PHP built in magic.mime. Using a custom magicfile with finfo with just the below contents reports the mime type for those files correctly. For the avoidance of doubt file -i also reports the wrong mime type unless I add the rows below to /etc/magic, so this might actually be an upstream bug. id3v1.mp3: application/octet-stream; charset=binary # for the test script the following is the file 'mp3id3v1_magic.mime'. 0 string ID3 audio/mpeg !:mime audio/mpeg Test script: --------------- <?php echo mime_content_type('id3v1.mp3') . "\n"; $finfo = new finfo(FILEINFO_MIME_TYPE); echo $finfo->file($filePath) . "\n"; $finfo = new finfo(FILEINFO_MIME_TYPE, 'mp3id3v1_magic.mime'); echo $finfo->file($filePath) . "\n"; Expected result: ---------------- audio/mpeg audio/mpeg audio/mpeg Actual result: -------------- application/octet-stream application/octet-stream audio/mpeg