[wp-trac] [WordPress Trac] #52531: Unable to upload .ico with PHP 7.4
WordPress Trac
noreply at wordpress.org
Mon Aug 9 16:40:25 UTC 2021
#52531: Unable to upload .ico with PHP 7.4
--------------------------+------------------------------
Reporter: lpointet | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Upload | Version: 5.6.1
Severity: normal | Resolution:
Keywords: has-patch | Focuses:
--------------------------+------------------------------
Comment (by jefferyto):
While I haven't tested the output of `finfo_file()` in my case, I'm pretty
sure my PR (https://github.com/WordPress/wordpress-develop/pull/1562)
addresses the root cause, since `wp_get_image_mime()` is
[https://core.trac.wordpress.org/browser/trunk/src/wp-
includes/functions.php?rev=51585#L2874 called] (and the mimes to exts list
tested) in the image type validation section before `finfo_file()` is
[https://core.trac.wordpress.org/browser/trunk/src/wp-
includes/functions.php?rev=51585#L2920 tried].
(As a side note, I think `image/heic` can also be added to the default
`getimagesizes_mimes_to_exts` list since it is also in the list of
recognized/allowed [https://core.trac.wordpress.org/browser/trunk/src/wp-
includes/functions.php?rev=51585#L3152 mime types], but I wanted to keep
the PR focused on this ticket / fixing ICO file uploads.)
Plugins/themes can also work around this issue with something like:
{{{
#!php
<?php
function trac52531_getimagesize_mimes_to_exts( $mime_to_ext ) {
$mime_to_ext['image/x-icon'] = 'ico';
$mime_to_ext['image/vnd.microsoft.icon'] = 'ico';
return $mime_to_ext;
}
add_filter( 'getimagesize_mimes_to_exts',
'trac52531_getimagesize_mimes_to_exts' );
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/52531#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list