r110821 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r110820‎ | r110821 | r110822 >
Date:02:49, 7 February 2012
Author:johnduhart
Status:ok (Comments)
Tags:1.18 
Comment:
Fixes bug 33165 - GlobalFunctions.php line 1312: Call to a member function getText() on a non-object
Modified paths:
  • /trunk/phase3/RELEASE-NOTES-1.19 (modified) (history)
  • /trunk/phase3/includes/GlobalFunctions.php (modified) (history)

Diff [purge]

Index: trunk/phase3/RELEASE-NOTES-1.19
@@ -243,6 +243,8 @@
244244 * Special:Contributions/newbies now shows the contributions for the user "newbies".
245245 New user contributions are obtained using the form or using ?contribs=newbie in URL.
246246 * It is now possible to delete images that have no corresponding description pages.
 247+* (bug 33165) GlobalFunctions.php line 1312: Call to a member function
 248+ getText() on a non-object
247249
248250 === API changes in 1.19 ===
249251 * Made action=edit less likely to return "unknownerror", by returning the actual error
Index: trunk/phase3/includes/GlobalFunctions.php
@@ -1555,14 +1555,19 @@
15561556 }
15571557
15581558 $messageCache = MessageCache::singleton();
1559 - if( in_array( 'parse', $options, true ) ) {
1560 - $string = $messageCache->parse( $string, null, true, !$forContent, $langCodeObj )->getText();
1561 - } elseif ( in_array( 'parseinline', $options, true ) ) {
1562 - $string = $messageCache->parse( $string, null, true, !$forContent, $langCodeObj )->getText();
1563 - $m = array();
1564 - if( preg_match( '/^<p>(.*)\n?<\/p>\n?$/sU', $string, $m ) ) {
1565 - $string = $m[1];
 1559+ $parseInline = in_array( 'parseinline', $options, true );
 1560+ if( in_array( 'parse', $options, true ) || $parseInline ) {
 1561+ $string = $messageCache->parse( $string, null, true, !$forContent, $langCodeObj );
 1562+ if ( $string instanceof ParserOutput ) {
 1563+ $string = $string->getText();
15661564 }
 1565+
 1566+ if ( $parseInline ) {
 1567+ $m = array();
 1568+ if( preg_match( '/^<p>(.*)\n?<\/p>\n?$/sU', $string, $m ) ) {
 1569+ $string = $m[1];
 1570+ }
 1571+ }
15671572 } elseif ( in_array( 'parsemag', $options, true ) ) {
15681573 $string = $messageCache->transform( $string,
15691574 !$forContent, $langCodeObj );

Comments

#Comment by MarkAHershberger (talk | contribs)   11:11, 23 April 2012

this needs to be merged for another 1.18 release.

#Comment by Krinkle (talk | contribs)   04:57, 5 July 2012

Reminder: Old revs in svn with a "merge to" type of tag. Please remove if already done or no longer relevant.

Status & tagging log