Fixes bug 33165 - GlobalFunctions.php line 1312: Call to a member function getText...
authorJohn Du Hart <johnduhart@users.mediawiki.org>
Tue, 7 Feb 2012 02:49:28 +0000 (02:49 +0000)
committerJohn Du Hart <johnduhart@users.mediawiki.org>
Tue, 7 Feb 2012 02:49:28 +0000 (02:49 +0000)
RELEASE-NOTES-1.19
includes/GlobalFunctions.php

index 8b90f0f..ce0c471 100644 (file)
@@ -243,6 +243,8 @@ production.
 * Special:Contributions/newbies now shows the contributions for the user "newbies".
   New user contributions are obtained using the form or using ?contribs=newbie in URL.
 * It is now possible to delete images that have no corresponding description pages.
+* (bug 33165) GlobalFunctions.php line 1312: Call to a member function
+  getText() on a non-object
 
 === API changes in 1.19 ===
 * Made action=edit less likely to return "unknownerror", by returning the actual error
index 314350b..ab93508 100644 (file)
@@ -1555,13 +1555,18 @@ function wfMsgExt( $key, $options ) {
        }
 
        $messageCache = MessageCache::singleton();
-       if( in_array( 'parse', $options, true ) ) {
-               $string = $messageCache->parse( $string, null, true, !$forContent, $langCodeObj )->getText();
-       } elseif ( in_array( 'parseinline', $options, true ) ) {
-               $string = $messageCache->parse( $string, null, true, !$forContent, $langCodeObj )->getText();
-               $m = array();
-               if( preg_match( '/^<p>(.*)\n?<\/p>\n?$/sU', $string, $m ) ) {
-                       $string = $m[1];
+       $parseInline = in_array( 'parseinline', $options, true );
+       if( in_array( 'parse', $options, true ) || $parseInline ) {
+               $string = $messageCache->parse( $string, null, true, !$forContent, $langCodeObj );
+               if ( $string instanceof ParserOutput ) {
+                       $string = $string->getText();
+               }
+
+               if ( $parseInline ) {
+                       $m = array();
+                       if( preg_match( '/^<p>(.*)\n?<\/p>\n?$/sU', $string, $m ) ) {
+                               $string = $m[1];
+                       }
                }
        } elseif ( in_array( 'parsemag', $options, true ) ) {
                $string = $messageCache->transform( $string,