r107359 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r107358‎ | r107359 | r107360 >
Date:02:57, 27 December 2011
Author:bawolff
Status:reverted
Tags:
Comment:
(bug 31719) Apply Derk-Jan Hartman's patch to make '&ns_svg;' considered a namespace for svg files. Work around issue where entities not expanded by our SVGMetadataReader.

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.
Modified paths:
  • /trunk/phase3/RELEASE-NOTES-1.19 (modified) (history)
  • /trunk/phase3/includes/media/SVGMetadataExtractor.php (modified) (history)

Diff [purge]

Index: trunk/phase3/RELEASE-NOTES-1.19
@@ -198,6 +198,7 @@
199199 cssText after DOM insertion.
200200 * (bug 30711) When adding a new section to a page with section=new, the text is
201201 now always added to the current version of the page
 202+* (bug 31719) Recognize &ns_svg; as the svg namespace when extracting width
202203
203204 === API changes in 1.19 ===
204205 * (bug 19838) siprop=interwikimap can now use the interwiki cache.
Index: trunk/phase3/includes/media/SVGMetadataExtractor.php
@@ -36,6 +36,7 @@
3737 const DEFAULT_WIDTH = 512;
3838 const DEFAULT_HEIGHT = 512;
3939 const NS_SVG = 'http://www.w3.org/2000/svg';
 40+ const ADOBE_SVG_ENTITY = '&ns_svg;';
4041
4142 private $reader = null;
4243 private $mDebug = false;
@@ -102,7 +103,10 @@
103104 $keepReading = $this->reader->read();
104105 }
105106
106 - if ( $this->reader->localName != 'svg' || $this->reader->namespaceURI != self::NS_SVG ) {
 107+ # Note, entities not expanded in namespaceURI - bug 31719
 108+ if ( $this->reader->localName != 'svg' ||
 109+ ( $this->reader->namespaceURI != self::NS_SVG &&
 110+ $this->reader->namespaceURI != self::ADOBE_SVG_ENTITY ) ) {
107111 throw new MWException( "Expected <svg> tag, got ".
108112 $this->reader->localName . " in NS " . $this->reader->namespaceURI );
109113 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r107792MFT r107359: fix Adobe Illustrator SVGs presumably broken by a PHP upgradetstarling00:07, 2 January 2012
r107793(bug 31719) Revert r107359 and apply a proper solution for entity expansion i...tstarling03:15, 2 January 2012
r107940PHPUnit test case for bug 31719 (followup r107793)brion21:12, 3 January 2012

Status & tagging log