From: Roan Kattouw Date: Mon, 18 Oct 2010 15:11:48 +0000 (+0000) Subject: Per r74946 CR, check whether realpath( $file ) returns false before using it X-Git-Tag: 1.31.0-rc.0~34449 X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_ecrire%28%22messagerie%22%29%20.%20%22?a=commitdiff_plain;h=bd02732734546216a8b28c64d3cd41266209a50e;p=lhc%2Fweb%2Fwiklou.git Per r74946 CR, check whether realpath( $file ) returns false before using it --- diff --git a/includes/libs/CSSMin.php b/includes/libs/CSSMin.php index 081482be68..945adde385 100644 --- a/includes/libs/CSSMin.php +++ b/includes/libs/CSSMin.php @@ -99,10 +99,11 @@ class CSSMin { $url .= '?' . gmdate( 'Y-m-d\TH:i:s\Z', round( filemtime( $file ), -2 ) ); // If we the mime-type can't be determined, no embedding will take place $type = false; + $realpath = realpath( $file ); // Try a couple of different ways to get the mime-type of a file, in order of preference - if ( function_exists( 'finfo_file' ) && function_exists( 'finfo_open' ) ) { + if ( $realpath && function_exists( 'finfo_file' ) && function_exists( 'finfo_open' ) ) { // As of PHP 5.3, this is how you get the mime-type of a file; it uses the Fileinfo PECL extension - $type = finfo_file( finfo_open( FILEINFO_MIME_TYPE ), realpath( $file ) ); + $type = finfo_file( finfo_open( FILEINFO_MIME_TYPE ), $realpath ); } else if ( function_exists( 'mime_content_type' ) ) { // Before this was deprecated in PHP 5.3, this used to be how you get the mime-type of a file $type = mime_content_type( $file );