From 59bcb425f86618b46be136accd0f99170ab0e511 Mon Sep 17 00:00:00 2001 From: "This, that and the other" Date: Sat, 26 Jul 2014 18:55:29 +1000 Subject: [PATCH] Use XML localName when importing XMLReader#name gives the qualified name, which was not a good thing to use. Bug: T6520 Change-Id: I8174fe64791f0e8d0c6677169595201446eab583 --- includes/Import.php | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/includes/Import.php b/includes/Import.php index de453b5a5f..a4424bc58a 100644 --- a/includes/Import.php +++ b/includes/Import.php @@ -523,10 +523,10 @@ class WikiImporter { $oldDisable = libxml_disable_entity_loader( true ); $this->reader->read(); - if ( $this->reader->name != 'mediawiki' ) { + if ( $this->reader->localName != 'mediawiki' ) { libxml_disable_entity_loader( $oldDisable ); throw new MWException( "Expected tag, got " . - $this->reader->name ); + $this->reader->localName ); } $this->debug( " tag is correct." ); @@ -537,7 +537,7 @@ class WikiImporter { $rethrow = null; try { while ( $keepReading ) { - $tag = $this->reader->name; + $tag = $this->reader->localName; $type = $this->reader->nodeType; if ( !Hooks::run( 'ImportHandleToplevelXMLTag', array( $this ) ) ) { @@ -588,11 +588,11 @@ class WikiImporter { while ( $this->reader->read() ) { if ( $this->reader->nodeType == XmlReader::END_ELEMENT && - $this->reader->name == 'siteinfo' ) { + $this->reader->localName == 'siteinfo' ) { break; } - $tag = $this->reader->name; + $tag = $this->reader->localName; if ( $tag == 'namespace' ) { $this->foreignNamespaces[ $this->nodeAttribute( 'key' ) ] = @@ -616,11 +616,11 @@ class WikiImporter { while ( $this->reader->read() ) { if ( $this->reader->nodeType == XMLReader::END_ELEMENT && - $this->reader->name == 'logitem' ) { + $this->reader->localName == 'logitem' ) { break; } - $tag = $this->reader->name; + $tag = $this->reader->localName; if ( !Hooks::run( 'ImportHandleLogItemXMLTag', array( $this, $logInfo @@ -680,13 +680,13 @@ class WikiImporter { while ( $skip ? $this->reader->next() : $this->reader->read() ) { if ( $this->reader->nodeType == XMLReader::END_ELEMENT && - $this->reader->name == 'page' ) { + $this->reader->localName == 'page' ) { break; } $skip = false; - $tag = $this->reader->name; + $tag = $this->reader->localName; if ( $badTitle ) { // The title is invalid, bail out of this page @@ -753,11 +753,11 @@ class WikiImporter { while ( $skip ? $this->reader->next() : $this->reader->read() ) { if ( $this->reader->nodeType == XMLReader::END_ELEMENT && - $this->reader->name == 'revision' ) { + $this->reader->localName == 'revision' ) { break; } - $tag = $this->reader->name; + $tag = $this->reader->localName; if ( !Hooks::run( 'ImportHandleRevisionXMLTag', array( $this, $pageInfo, $revisionInfo @@ -845,11 +845,11 @@ class WikiImporter { while ( $skip ? $this->reader->next() : $this->reader->read() ) { if ( $this->reader->nodeType == XMLReader::END_ELEMENT && - $this->reader->name == 'upload' ) { + $this->reader->localName == 'upload' ) { break; } - $tag = $this->reader->name; + $tag = $this->reader->localName; if ( !Hooks::run( 'ImportHandleUploadXMLTag', array( $this, $pageInfo @@ -943,11 +943,11 @@ class WikiImporter { while ( $this->reader->read() ) { if ( $this->reader->nodeType == XMLReader::END_ELEMENT && - $this->reader->name == 'contributor' ) { + $this->reader->localName == 'contributor' ) { break; } - $tag = $this->reader->name; + $tag = $this->reader->localName; if ( in_array( $tag, $fields ) ) { $info[$tag] = $this->nodeContents(); -- 2.20.1