X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/membres/fiche.php?a=blobdiff_plain;f=includes%2Flibs%2FCSSMin.php;h=3129c5b21bcfdd49e869a1ba219102cc623e99c4;hb=d4cc4f2b4f20725725a9345c7a4b7906e5aa66d2;hp=74e8b54e2a9291766c13c236e795c7a216ed8884;hpb=f459a71f75941a83335d6d63ee12079a4b586793;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/libs/CSSMin.php b/includes/libs/CSSMin.php index 74e8b54e2a..3129c5b21b 100644 --- a/includes/libs/CSSMin.php +++ b/includes/libs/CSSMin.php @@ -72,15 +72,24 @@ class CSSMin { $url = $match['file'][0]; // Skip fully-qualified and protocol-relative URLs and data URIs - // Also skips the rare `behavior` property specifying application's default behavior if ( substr( $url, 0, 2 ) === '//' || - parse_url( $url, PHP_URL_SCHEME ) || - substr( $url, 0, 9 ) === '#default#' + parse_url( $url, PHP_URL_SCHEME ) ) { break; } + // Strip trailing anchors - T115436 + $anchor = strpos( $url, '#' ); + if ( $anchor !== false ) { + $url = substr( $url, 0, $anchor ); + + // '#some-anchors' is not a file + if ( $url === '' ) { + break; + } + } + $files[] = $path . $url; } } @@ -193,11 +202,7 @@ class CSSMin { public static function getMimeType( $file ) { // Infer the MIME-type from the file extension $ext = strtolower( pathinfo( $file, PATHINFO_EXTENSION ) ); - if ( isset( self::$mimeTypes[$ext] ) ) { - return self::$mimeTypes[$ext]; - } - - return mime_content_type( realpath( $file ) ); + return self::$mimeTypes[$ext] ?? mime_content_type( realpath( $file ) ); } /** @@ -485,11 +490,11 @@ class CSSMin { // Pass thru fully-qualified and protocol-relative URLs and data URIs, as well as local URLs if // we can't expand them. - // Also skips the rare `behavior` property specifying application's default behavior + // Also skips anchors or the rare `behavior` property specifying application's default behavior if ( self::isRemoteUrl( $url ) || self::isLocalUrl( $url ) || - substr( $url, 0, 9 ) === '#default#' + substr( $url, 0, 1 ) === '#' ) { return $url; }