(bug 31719) Apply Derk-Jan Hartman's patch to make '&ns_svg;' considered a namespace...
authorBrian Wolff <bawolff@users.mediawiki.org>
Tue, 27 Dec 2011 02:57:25 +0000 (02:57 +0000)
committerBrian Wolff <bawolff@users.mediawiki.org>
Tue, 27 Dec 2011 02:57:25 +0000 (02:57 +0000)
I'm leaving the bug open, since I'm not sure if this is a proper fix, but I think its significantly better than the current situation.

RELEASE-NOTES-1.19
includes/media/SVGMetadataExtractor.php

index f279555..182ef6d 100644 (file)
@@ -198,6 +198,7 @@ production.
   cssText after DOM insertion.
 * (bug 30711) When adding a new section to a page with section=new, the text is
   now always added to the current version of the page
+* (bug 31719) Recognize &ns_svg; as the svg namespace when extracting width
 
 === API changes in 1.19 ===
 * (bug 19838) siprop=interwikimap can now use the interwiki cache.
index f20482b..1da5b94 100644 (file)
@@ -36,6 +36,7 @@ class SVGReader {
        const DEFAULT_WIDTH = 512;
        const DEFAULT_HEIGHT = 512;
        const NS_SVG = 'http://www.w3.org/2000/svg';
+       const ADOBE_SVG_ENTITY = '&ns_svg;';
 
        private $reader = null;
        private $mDebug = false;
@@ -102,7 +103,10 @@ class SVGReader {
                        $keepReading = $this->reader->read();
                }
 
-               if ( $this->reader->localName != 'svg' || $this->reader->namespaceURI != self::NS_SVG ) {
+               # Note, entities not expanded in namespaceURI - bug 31719
+               if ( $this->reader->localName != 'svg' || 
+                       ( $this->reader->namespaceURI != self::NS_SVG &&
+                         $this->reader->namespaceURI != self::ADOBE_SVG_ENTITY ) ) {
                        throw new MWException( "Expected <svg> tag, got ".
                                $this->reader->localName . " in NS " . $this->reader->namespaceURI );
                }