Merge "Handle missing namespace prefix in XML dumps more gracefully"
[lhc/web/wiklou.git] / includes / export / XmlDumpWriter.php
index 5be166b..5a1f92c 100644 (file)
@@ -269,7 +269,9 @@ class XmlDumpWriter {
                        $out .= "      <sha1/>\n";
                }
 
-               Hooks::run( 'XmlDumpWriterWriteRevision', [ &$this, &$out, $row, $text ] );
+               // Avoid PHP 7.1 warning from passing $this by reference
+               $writer = $this;
+               Hooks::run( 'XmlDumpWriterWriteRevision', [ &$writer, &$out, $row, $text ] );
 
                $out .= "    </revision>\n";
 
@@ -431,6 +433,9 @@ class XmlDumpWriter {
                global $wgContLang;
                $prefix = $wgContLang->getFormattedNsText( $title->getNamespace() );
 
+               // @todo Emit some kind of warning to the user if $title->getNamespace() !==
+               // NS_MAIN and $prefix === '' (viz. pages in an unregistered namespace)
+
                if ( $prefix !== '' ) {
                        $prefix .= ':';
                }