-
Notifications
You must be signed in to change notification settings - Fork 7.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
finfo returns wrong mime type for woff/woff2 files #8805
Comments
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 |
@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. Thanks |
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 |
[ci skip] Signed-off-by: Anatol Belski <ab@php.net>
* PHP-8.1: NEWS: Add entry for GH-8805
[ci skip] Signed-off-by: Anatol Belski <ab@php.net>
@adoy @cmb69 i just went pushing a fresh 5.43 port to master. Given the diffs, i think backporting to 8.2 can be done. There is probably no immediate necessity to backport, but therene's a change in the magic DB features, that would suggest to upgrade so bugfixes are easier. Backporting somewhen early next year after sufficient observation in master is what i'd suggest, if RMs are ok. Thanks |
@weltling Lgtm. Thanks for your work ! |
As of PHP 8.1.12, which includes libmagic/file update to version 5.42, the expected mime type for WOFF files has changed to `font/woff`, so the type needs to be adjusted accordingly in `wp_check_filetype_and_ext()` tests. References: * [php/php-src#8805 php-src: #8805: finfo returns wrong mime type for woff/woff2 files] * [https://www.php.net/ChangeLog-8.php#8.1.12 PHP 8.1.12 changelog] Follow-up to [40124], [54508], [54509], [54724]. Props costdev, SergeyBiryukov. Fixes #56817. Built from https://develop.svn.wordpress.org/trunk@55462 git-svn-id: http://core.svn.wordpress.org/trunk@54995 1a063a9b-81f0-0310-95a4-ce76da25c4cd
As of PHP 8.1.12, which includes libmagic/file update to version 5.42, the expected mime type for WOFF files has changed to `font/woff`, so the type needs to be adjusted accordingly in `wp_check_filetype_and_ext()` tests. References: * [php/php-src#8805 php-src: #8805: finfo returns wrong mime type for woff/woff2 files] * [https://www.php.net/ChangeLog-8.php#8.1.12 PHP 8.1.12 changelog] Follow-up to [40124], [54508], [54509], [54724]. Props costdev, SergeyBiryukov. Fixes #56817. Built from https://develop.svn.wordpress.org/trunk@55462 git-svn-id: https://core.svn.wordpress.org/trunk@54995 1a063a9b-81f0-0310-95a4-ce76da25c4cd
As of PHP 8.1.12, which includes libmagic/file update to version 5.42, the expected mime type for WOFF files has changed to `font/woff`, so the type needs to be adjusted accordingly in `wp_check_filetype_and_ext()` tests. References: * [php/php-src#8805 php-src: #8805: finfo returns wrong mime type for woff/woff2 files] * [https://www.php.net/ChangeLog-8.php#8.1.12 PHP 8.1.12 changelog] Follow-up to [40124], [54508], [54509], [54724]. Props costdev, SergeyBiryukov. Merges [55462] to the 6.1 branch. Fixes #56817. git-svn-id: https://develop.svn.wordpress.org/branches/6.1@55463 602fd350-edb4-49c9-b593-d223f7449a82
As of PHP 8.1.12, which includes libmagic/file update to version 5.42, the expected mime type for WOFF files has changed to `font/woff`, so the type needs to be adjusted accordingly in `wp_check_filetype_and_ext()` tests. References: * [php/php-src#8805 php-src: #8805: finfo returns wrong mime type for woff/woff2 files] * [https://www.php.net/ChangeLog-8.php#8.1.12 PHP 8.1.12 changelog] Follow-up to [40124], [54508], [54509], [54724]. Props costdev, SergeyBiryukov. Merges [55462] to the 6.1 branch. Fixes #56817. Built from https://develop.svn.wordpress.org/branches/6.1@55463 git-svn-id: http://core.svn.wordpress.org/branches/6.1@54996 1a063a9b-81f0-0310-95a4-ce76da25c4cd
As of PHP 8.1.12, which includes libmagic/file update to version 5.42, the expected mime type for WOFF files has changed to `font/woff`, so the type needs to be adjusted accordingly in `wp_check_filetype_and_ext()` tests. References: * [php/php-src#8805 php-src: #8805: finfo returns wrong mime type for woff/woff2 files] * [https://www.php.net/ChangeLog-8.php#8.1.12 PHP 8.1.12 changelog] Follow-up to [40124], [54508], [54509], [54724]. Props desrosj, jrf, costdev, SergeyBiryukov. Merges [55462] to the 5.9 branch. Fixes #56817. git-svn-id: https://develop.svn.wordpress.org/branches/5.9@55498 602fd350-edb4-49c9-b593-d223f7449a82
As of PHP 8.1.12, which includes libmagic/file update to version 5.42, the expected mime type for WOFF files has changed to `font/woff`, so the type needs to be adjusted accordingly in `wp_check_filetype_and_ext()` tests. References: * [php/php-src#8805 php-src: #8805: finfo returns wrong mime type for woff/woff2 files] * [https://www.php.net/ChangeLog-8.php#8.1.12 PHP 8.1.12 changelog] Follow-up to [40124], [54508], [54509], [54724]. Props desrosj, jrf, costdev, SergeyBiryukov. Merges [55462] to the 6.0 branch. Fixes #56817. git-svn-id: https://develop.svn.wordpress.org/branches/6.0@55497 602fd350-edb4-49c9-b593-d223f7449a82
As of PHP 8.1.12, which includes libmagic/file update to version 5.42, the expected mime type for WOFF files has changed to `font/woff`, so the type needs to be adjusted accordingly in `wp_check_filetype_and_ext()` tests. References: * [php/php-src#8805 php-src: #8805: finfo returns wrong mime type for woff/woff2 files] * [https://www.php.net/ChangeLog-8.php#8.1.12 PHP 8.1.12 changelog] Follow-up to [40124], [54508], [54509], [54724]. Props desrosj, jrf, costdev, SergeyBiryukov. Merges [55462] to the 6.0 branch. Fixes #56817. Built from https://develop.svn.wordpress.org/branches/6.0@55497 git-svn-id: http://core.svn.wordpress.org/branches/6.0@55030 1a063a9b-81f0-0310-95a4-ce76da25c4cd
As of PHP 8.1.12, which includes libmagic/file update to version 5.42, the expected mime type for WOFF files has changed to `font/woff`, so the type needs to be adjusted accordingly in `wp_check_filetype_and_ext()` tests. References: * [php/php-src#8805 php-src: #8805: finfo returns wrong mime type for woff/woff2 files] * [https://www.php.net/ChangeLog-8.php#8.1.12 PHP 8.1.12 changelog] Follow-up to [40124], [54508], [54509], [54724]. Props costdev, SergeyBiryukov. Fixes #56817. Built from https://develop.svn.wordpress.org/trunk@55462 git-svn-id: http://core.svn.wordpress.org/trunk@54995 1a063a9b-81f0-0310-95a4-ce76da25c4cd
As of PHP 8.1.12, which includes libmagic/file update to version 5.42, the expected mime type for WOFF files has changed to `font/woff`, so the type needs to be adjusted accordingly in `wp_check_filetype_and_ext()` tests. References: * [php/php-src#8805 php-src: #8805: finfo returns wrong mime type for woff/woff2 files] * [https://www.php.net/ChangeLog-8.php#8.1.12 PHP 8.1.12 changelog] Follow-up to [40124], [54508], [54509], [54724]. Props costdev, SergeyBiryukov. Merges [55462] to the 6.1 branch. Fixes #56817. Built from https://develop.svn.wordpress.org/branches/6.1@55463 git-svn-id: http://core.svn.wordpress.org/branches/6.1@54996 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Fixes a bug where fonts could not be installed in PHP 8.1.0 through 8.1.11 due to incorrect MIME type assignment. While `WP_Font_Utils::get_allowed_font_mime_types()` conditionally sets the MIME type for woff and woff2, it incorrectly checks against PHP 8.1.0. The MIME type change did not occur until PHP 8.1.12. References: * PHP-src: finfo returns wrong mime type for woff/woff2 files php/php-src#8805 * PHP 8.1.12 changelog https://www.php.net/ChangeLog-8.php#8.1.12 * Tests: Adjust the expected mime type for WOFF fonts on PHP 8.1.12+ WordPress@5eefddf * Gutenberg PR 59015 WordPress/gutenberg#59015 Props @costdev.
Fixes a bug where fonts could not be installed in PHP 8.1.0 through 8.1.11 due to incorrect MIME type assignment. While `WP_Font_Utils::get_allowed_font_mime_types()` conditionally sets the MIME type for woff and woff2, it incorrectly checks against PHP 8.1.0. The MIME type change did not occur until PHP 8.1.12. References: * [php/php-src#8805 PHP-src: finfo returns wrong mime type for woff/woff2 files]. * [https://www.php.net/ChangeLog-8.php#8.1.12 PHP 8.1.12 changelog]. * Tests: Adjust the expected mime type for WOFF fonts on PHP 8.1.12+ [55463]. * [WordPress/gutenberg#59015 Gutenberg PR 59015]. Follow-up to [57539]. Props costdev, kafleg, hellofromTonya. Fixes 60536. git-svn-id: https://develop.svn.wordpress.org/trunk@57632 602fd350-edb4-49c9-b593-d223f7449a82
Fixes a bug where fonts could not be installed in PHP 8.1.0 through 8.1.11 due to incorrect MIME type assignment. While `WP_Font_Utils::get_allowed_font_mime_types()` conditionally sets the MIME type for woff and woff2, it incorrectly checks against PHP 8.1.0. The MIME type change did not occur until PHP 8.1.12. References: * [php/php-src#8805 PHP-src: finfo returns wrong mime type for woff/woff2 files]. * [https://www.php.net/ChangeLog-8.php#8.1.12 PHP 8.1.12 changelog]. * Tests: Adjust the expected mime type for WOFF fonts on PHP 8.1.12+ [55463]. * [WordPress/gutenberg#59015 Gutenberg PR 59015]. Follow-up to [57539]. Props costdev, kafleg, hellofromTonya. Fixes 60536. Built from https://develop.svn.wordpress.org/trunk@57632 git-svn-id: https://core.svn.wordpress.org/trunk@57133 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Fixes a bug where fonts could not be installed in PHP 8.1.0 through 8.1.11 due to incorrect MIME type assignment. While `WP_Font_Utils::get_allowed_font_mime_types()` conditionally sets the MIME type for woff and woff2, it incorrectly checks against PHP 8.1.0. The MIME type change did not occur until PHP 8.1.12. References: * [php/php-src#8805 PHP-src: finfo returns wrong mime type for woff/woff2 files]. * [https://www.php.net/ChangeLog-8.php#8.1.12 PHP 8.1.12 changelog]. * Tests: Adjust the expected mime type for WOFF fonts on PHP 8.1.12+ [55463]. * [WordPress/gutenberg#59015 Gutenberg PR 59015]. Follow-up to [57539]. Props costdev, kafleg, hellofromTonya. Fixes 60536. Built from https://develop.svn.wordpress.org/trunk@57632 git-svn-id: http://core.svn.wordpress.org/trunk@57133 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Description
Uploaded woff/woff2 return incorrect mime type.
The following code:
Resulted in this output:
But I expected this output instead:
Mime type has been fixed in libmagic/file in version 5.42.
file/file@7a821ae
PHP Version
8.1.7
Operating System
Alpine 3.16
The text was updated successfully, but these errors were encountered: