http://www.mediawiki.org/wiki/Special:Code/MediaWiki/89931

Revision: 89931
Author:   foxtrott
Date:     2011-06-12 16:43:16 +0000 (Sun, 12 Jun 2011)
Log Message:
-----------
bugfix (Trying to get property of non-object)

Modified Paths:
--------------
    trunk/extensions/Lingo/LingoParser.php

Modified: trunk/extensions/Lingo/LingoParser.php
===================================================================
--- trunk/extensions/Lingo/LingoParser.php      2011-06-12 14:49:57 UTC (rev 
89930)
+++ trunk/extensions/Lingo/LingoParser.php      2011-06-12 16:43:16 UTC (rev 
89931)
@@ -151,7 +151,7 @@
                wfSuppressWarnings();
 
                $doc = DOMDocument::loadHTML(
-                               '<html><meta http-equiv="content-type" 
content="charset=utf-8"/>' . $text . '</html>'
+                               '<html><head><meta http-equiv="content-type" 
content="charset=utf-8"/></head><body>' . $text . '</body></html>'
                );
 
                wfRestoreWarnings();
@@ -251,12 +251,14 @@
                if ( $changedDoc ) {
                        $body = $xpath->query( '/html/body' );
 
-                       $text = '';
-                       foreach ( $body->item( 0 )->childNodes as $child ) {
-                               $text .= $doc->saveXML( $child );
+                       if ( $body->length > 0 ) {
+                               $text = '';
+                               foreach ( $body->item( 0 )->childNodes as 
$child ) {
+                                       $text .= $doc->saveXML( $child );
+                               }
+
+                               $this->loadModules( $parser );
                        }
-
-                       $this->loadModules( $parser );
                }
 
                wfProfileOut( __METHOD__ );


_______________________________________________
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to