From c14f7baedaea472483923ef1e18f1dca72a288e3 Mon Sep 17 00:00:00 2001 From: Derk-Jan Hartman Date: Thu, 4 Nov 2010 13:42:42 +0000 Subject: [PATCH] Skip comments and stuff before the element. --- includes/media/SVGMetadataExtractor.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/includes/media/SVGMetadataExtractor.php b/includes/media/SVGMetadataExtractor.php index 66dc1259dc..a46d8389dc 100644 --- a/includes/media/SVGMetadataExtractor.php +++ b/includes/media/SVGMetadataExtractor.php @@ -67,18 +67,21 @@ class SVGReader { * Read the SVG */ public function read() { - $this->reader->read(); + $keepReading = $this->reader->read(); + + /* Skip until first element */ + while( $keepReading && $this->reader->nodeType != XmlReader::ELEMENT ) { + $keepReading = $this->reader->read(); + } if ( $this->reader->name != 'svg' ) { throw new MWException( "Expected tag, got ". $this->reader->name ); } $this->debug( " tag is correct." ); - - $this->debug( "Starting primary dump processing loop." ); $this->handleSVGAttribs(); - $exitDepth = $this->reader->depth; + $exitDepth = $this->reader->depth; $keepReading = $this->reader->read(); $skip = false; while ( $keepReading ) { -- 2.20.1