From daeb57099d7391be0b6dbda8dbe68f28cf99b0df Mon Sep 17 00:00:00 2001 From: John Du Hart Date: Tue, 7 Feb 2012 02:49:28 +0000 Subject: [PATCH] Fixes bug 33165 - GlobalFunctions.php line 1312: Call to a member function getText() on a non-object --- RELEASE-NOTES-1.19 | 2 ++ includes/GlobalFunctions.php | 19 ++++++++++++------- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/RELEASE-NOTES-1.19 b/RELEASE-NOTES-1.19 index 8b90f0f8b4..ce0c471c27 100644 --- a/RELEASE-NOTES-1.19 +++ b/RELEASE-NOTES-1.19 @@ -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 diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index 314350b861..ab93508fd8 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -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( '/^

(.*)\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( '/^

(.*)\n?<\/p>\n?$/sU', $string, $m ) ) { + $string = $m[1]; + } } } elseif ( in_array( 'parsemag', $options, true ) ) { $string = $messageCache->transform( $string, -- 2.20.1