In `wp_mime_type_icon()`, the length of the `$wilds` array varies depending on what is passed as `$mime`. Loop over `$wilds` instead of arbitrarily checking `$wilds[0]`.

Adds unit tests.

Fixes #33012.


Built from https://develop.svn.wordpress.org/trunk@34255


git-svn-id: http://core.svn.wordpress.org/trunk@34219 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Scott Taylor 2015-09-17 00:37:25 +00:00
parent 6759f04a24
commit a87ef29978
2 changed files with 11 additions and 6 deletions

View File

@ -5081,11 +5081,16 @@ function wp_mime_type_icon( $mime = 0 ) {
$matches['default'] = array('default');
foreach ( $matches as $match => $wilds ) {
if ( isset($types[$wilds[0]])) {
$icon = $types[$wilds[0]];
if ( !is_numeric($mime) )
wp_cache_add("mime_type_icon_$mime", $icon);
break;
foreach ( $wilds as $wild ) {
if ( ! isset( $types[ $wild ] ) ) {
continue;
}
$icon = $types[ $wild ];
if ( ! is_numeric( $mime ) ) {
wp_cache_add( "mime_type_icon_$mime", $icon );
}
break 2;
}
}
}

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.4-alpha-34254';
$wp_version = '4.4-alpha-34255';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.