You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
finfo returns wrong mime type for woff/woff2 files #8805
// $path is a content of an uploaded woff or woff2 file$finfo = new \finfo(\FILEINFO_MIME_TYPE));
$mimeType = $finfo->file($path); // returns "application/octet-stream"echo$mimeType;
Resulted in this output:
returns "application/octet-stream"
But I expected this output instead:
expected result is: "font/woff"
Mime type has been fixed in libmagic/file in version 5.42.
We're still on 5.40. We should definitely update "master" (which will become PHP-8.2 in some weeks) to 5.42; I'm not quite sure about 5.41PHP-8.1; maybe just patching our 5.40 would make more sense.
@weltling You were the last one to update libmagic if i'm not wrong. Do you think it would be possible to update to 5.42 in master ? I would love to help but not sure what's the process to update this lib.
@kojot1234 could you share a suitable file to test this please?
@adoy@cmb69 probably too late for 8.2, but I'll plan to spend time porting the latest libmagic in the coming months. Once ported to main one can see if a backport to 8.2 is acceptable. Small data backports are always possible, anyway, as in most case it's about the magic itself, not about the lib code. Upgrading the lib is not trivial, that's why there's no standard procedure for that.
Activity
cmb69 commentedon Jun 16, 2022
Thanks for reporting!
We're still on 5.40. We should definitely update "master" (which will become PHP-8.2 in some weeks) to 5.42; I'm not quite sure about
5.41PHP-8.1; maybe just patching our 5.40 would make more sense.adoy commentedon Jun 22, 2022
@weltling You were the last one to update libmagic if i'm not wrong. Do you think it would be possible to update to 5.42 in master ? I would love to help but not sure what's the process to update this lib.
weltling commentedon Sep 10, 2022
@kojot1234 could you share a suitable file to test this please?
@adoy @cmb69 probably too late for 8.2, but I'll plan to spend time porting the latest libmagic in the coming months. Once ported to main one can see if a backport to 8.2 is acceptable. Small data backports are always possible, anyway, as in most case it's about the magic itself, not about the lib code. Upgrading the lib is not trivial, that's why there's no standard procedure for that.
Thanks
kojot1234 commentedon Sep 15, 2022
Thank you, I'm not able to attach woff in github, you can grab any of the files from this link: https://filesamples.com/formats/woff
fileinfo: magic: Backport mime type support for woff/woff2 fonts
NEWS: Add entry for GH-8805
Merge branch 'PHP-8.1' into PHP-8.2
NEWS: Add entry for GH-8805
7 remaining items
Tests: Adjust the expected mime type for WOFF fonts on PHP 8.1.12+.
Tests: Adjust the expected mime type for WOFF fonts on PHP 8.1.12+.
Tests: Adjust the expected mime type for WOFF fonts on PHP 8.1.12+.
Tests: Adjust the expected mime type for WOFF fonts on PHP 8.1.12+.
Tests: Adjust the expected mime type for WOFF fonts on PHP 8.1.12+.
PHP 8.1.12 not 8.1.0
Editor: Check PHP 8.1.12 for woff/woff2 mime types in WP_Font_Utils.
Editor: Check PHP 8.1.12 for woff/woff2 mime types in WP_Font_Utils.
Editor: Check PHP 8.1.12 for woff/woff2 mime types in WP_Font_Utils.
Tests: Adjust the expected mime type for WOFF fonts on PHP 8.1.12+.