r89931 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r89930‎ | r89931 | r89932 >
Date:16:43, 12 June 2011
Author:foxtrott
Status:deferred
Tags:
Comment:
bugfix (Trying to get property of non-object)
Modified paths:
  • /trunk/extensions/Lingo/LingoParser.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Lingo/LingoParser.php
@@ -151,7 +151,7 @@
152152 wfSuppressWarnings();
153153
154154 $doc = DOMDocument::loadHTML(
155 - '<html><meta http-equiv="content-type" content="charset=utf-8"/>' . $text . '</html>'
 155+ '<html><head><meta http-equiv="content-type" content="charset=utf-8"/></head><body>' . $text . '</body></html>'
156156 );
157157
158158 wfRestoreWarnings();
@@ -251,12 +251,14 @@
252252 if ( $changedDoc ) {
253253 $body = $xpath->query( '/html/body' );
254254
255 - $text = '';
256 - foreach ( $body->item( 0 )->childNodes as $child ) {
257 - $text .= $doc->saveXML( $child );
 255+ if ( $body->length > 0 ) {
 256+ $text = '';
 257+ foreach ( $body->item( 0 )->childNodes as $child ) {
 258+ $text .= $doc->saveXML( $child );
 259+ }
 260+
 261+ $this->loadModules( $parser );
258262 }
259 -
260 - $this->loadModules( $parser );
261263 }
262264
263265 wfProfileOut( __METHOD__ );

Status & tagging log