Merge "Fix TitlePermissionTest failures due to test leakage"
[lhc/web/wiklou.git] / includes / media / SVGMetadataExtractor.php
index e00a5b3..e52bf0b 100644 (file)
@@ -325,7 +325,7 @@ class SVGReader {
 
                if ( $this->reader->getAttribute( 'viewBox' ) ) {
                        // min-x min-y width height
-                       $viewBox = preg_split( '/\s+/', trim( $this->reader->getAttribute( 'viewBox' ) ) );
+                       $viewBox = preg_split( '/\s*[\s,]\s*/', trim( $this->reader->getAttribute( 'viewBox' ) ) );
                        if ( count( $viewBox ) == 4 ) {
                                $viewWidth = $this->scaleSVGUnit( $viewBox[2] );
                                $viewHeight = $this->scaleSVGUnit( $viewBox[3] );
@@ -380,7 +380,11 @@ class SVGReader {
                        '' => 1.0, // "User units" pixels by default
                ];
                $matches = [];
-               if ( preg_match( '/^\s*(\d+(?:\.\d+)?)(em|ex|px|pt|pc|cm|mm|in|%|)\s*$/', $length, $matches ) ) {
+               if ( preg_match(
+                       '/^\s*([-+]?\d*(?:\.\d+|\d+)(?:[Ee][-+]?\d+)?)\s*(em|ex|px|pt|pc|cm|mm|in|%|)\s*$/',
+                       $length,
+                       $matches
+               ) ) {
                        $length = floatval( $matches[1] );
                        $unit = $matches[2];
                        if ( $unit == '%' ) {