X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fmedia%2FSVGMetadataExtractor.php;h=ee467b084f91257b7aafd350128015b6cf8eae71;hb=1a8838bb6a590a835e7d03e80ddc2321bd8790d9;hp=9b22cbee1add53f0e15d5ff7b0863b3993bba2f1;hpb=a8dcb178c7e347ef56bef1e36bb4a26a61a1d82b;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/media/SVGMetadataExtractor.php b/includes/media/SVGMetadataExtractor.php index 9b22cbee1a..ee467b084f 100644 --- a/includes/media/SVGMetadataExtractor.php +++ b/includes/media/SVGMetadataExtractor.php @@ -22,7 +22,7 @@ * @author "Derk-Jan Hartman " * @author Brion Vibber * @copyright Copyright © 2010-2010 Brion Vibber, Derk-Jan Hartman - * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License + * @license GPL-2.0-or-later */ /** @@ -106,17 +106,17 @@ class SVGReader { // Because we cut off the end of the svg making an invalid one. Complicated // try catch thing to make sure warnings get restored. Seems like there should // be a better way. - MediaWiki\suppressWarnings(); + Wikimedia\suppressWarnings(); try { $this->read(); } catch ( Exception $e ) { // Note, if this happens, the width/height will be taken to be 0x0. // Should we consider it the default 512x512 instead? - MediaWiki\restoreWarnings(); + Wikimedia\restoreWarnings(); libxml_disable_entity_loader( $oldDisable ); throw $e; } - MediaWiki\restoreWarnings(); + Wikimedia\restoreWarnings(); libxml_disable_entity_loader( $oldDisable ); } @@ -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 == '%' ) {