r83047 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r83046‎ | r83047 | r83048 >
Date:21:22, 1 March 2011
Author:platonides
Status:deferred
Tags:
Comment:
Workaround r82645 'Invalid marker' bug. Actually the old 'wfMsgExt() reentering parser' bug.
Modified paths:
  • /trunk/extensions/ArticleComments/ArticleComments.php (modified) (history)

Diff [purge]

Index: trunk/extensions/ArticleComments/ArticleComments.php
@@ -127,7 +127,7 @@
128128
129129 function wfArticleCommentsParserHook( $text, $params = array(), $parser ) {
130130 # Generate a comment form for display
131 - return wfArticleCommentForm( $parser->mTitle, $params );
 131+ return wfArticleCommentForm( $parser->mTitle, $params, $parser );
132132 }
133133
134134 function wfArticleCommentsParserHookComment( $text, $args, $parser, $frame ) {
@@ -205,7 +205,7 @@
206206 * @param $skin Object: Skin object
207207 */
208208 function wfArticleCommentsAfterContent( $data, $skin ) {
209 - global $wgRequest, $wgArticleCommentsNSDisplayList;
 209+ global $wgRequest, $wgArticleCommentsNSDisplayList, $wgParser;
210210
211211 # Short-circuit for anything other than action=view or action=purge
212212 if ( $wgRequest->getVal( 'action' ) &&
@@ -234,7 +234,7 @@
235235
236236 # Display the form
237237 if ( in_array( $title->getNamespace(), $nsList ) ) {
238 - $data .= wfArticleCommentForm( $title );
 238+ $data .= wfArticleCommentForm( $title, array(), $wgParser );
239239 }
240240
241241 return true;
@@ -245,9 +245,13 @@
246246 * @param $title Object: the title of the article on which the form will appear.
247247 * @param $params Array: a hash of parameters containing rendering options.
248248 */
249 -function wfArticleCommentForm( $title, $params = array() ) {
250 - global $wgArticleCommentDefaults, $wgOut;
 249+function wfArticleCommentForm( $title, $params = array(), $parser ) {
 250+ global $wgArticleCommentDefaults, $wgOut, $wgParser, $wgParserConf;
251251
 252+ if ( $parser === $wgParser ) { # Needed since r82645. Workaround the 'Invalid marker' problem by giving a new parser to wfMsgExt().
 253+ $wgParser = new StubObject( 'wgParser', $wgParserConf['class'], array( $wgParserConf ) );
 254+ }
 255+
252256 # Merge in global defaults if specified
253257 $tmp = $wgArticleCommentDefaults;
254258 foreach ( $params as $k => $v ) {

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r82645* Rewrote StripState to not use ReplacementArray. The memory usage of FSS was...tstarling06:58, 23 February 2011

Status & tagging log