aboutsummaryrefslogtreecommitdiffstats
path: root/includes/libs/CSSMin.php
diff options
context:
space:
mode:
authorTimo Tijhof <krinklemail@gmail.com>2017-07-24 22:11:17 -0700
committerKrinkle <krinklemail@gmail.com>2017-07-27 02:18:43 +0000
commit7f000f86812f83c12e785a0f6092ee08337c663f (patch)
treea8fb9c6e71eafc5fb41505e682bf4cd7c288b754 /includes/libs/CSSMin.php
parent1a81ba9bcb801de0be82fbd44332dada53800879 (diff)
downloadmediawikicore-7f000f86812f83c12e785a0f6092ee08337c663f.tar.gz
mediawikicore-7f000f86812f83c12e785a0f6092ee08337c663f.zip
Re-introduce use of mime_content_type()
Follows-up eac059c7224. See also https://stackoverflow.com/a/39676272/319266. This function was never deprecated. For a short time, the www.php.net manual page for `mime_content_type` wrongly documented it as having been deprecated in PHP 5.3, but this wasn't true, and it has been present in every PHP version since PHP 4.3, including PHP 7 and HHVM 2.3+. Between PHP 4.3.0-4.3.2 and PHP 5.0-5.3, the function would be absent if the Mimemagic extension was not enabled at compile-time. However, while mime_content_type was first introduced by the Mimemagic PHP ext, it is backend by the Finfo extension since PHP 5.3.0. Confirmed via https://3v4l.org/IQC1Q. * CSSMin: Revert conditional use of finfo back to unconditional use of mime_content_type. * MimeAnalyzer: Replace conditional use of finfo with unconditional use use of mime_content_type. Also remove the now-redundant 'else' branch. The 'else' branch existed because this code was written at a time where MediaWiki still supported PHP 4, of which some minor versions could sometimes be compiled without this function. Change-Id: Iee4a0b6f616a469bb779c40e386045f9c3200446
Diffstat (limited to 'includes/libs/CSSMin.php')
-rw-r--r--includes/libs/CSSMin.php12
1 files changed, 1 insertions, 11 deletions
diff --git a/includes/libs/CSSMin.php b/includes/libs/CSSMin.php
index 9e060cd54a5e..4c672f4644de 100644
--- a/includes/libs/CSSMin.php
+++ b/includes/libs/CSSMin.php
@@ -188,17 +188,7 @@ class CSSMin {
return self::$mimeTypes[$ext];
}
- $realpath = realpath( $file );
- if (
- $realpath
- && function_exists( 'finfo_file' )
- && function_exists( 'finfo_open' )
- && defined( 'FILEINFO_MIME_TYPE' )
- ) {
- return finfo_file( finfo_open( FILEINFO_MIME_TYPE ), $realpath );
- }
-
- return false;
+ return mime_content_type( realpath( $file ) );
}
/**