r79892 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r79891‎ | r79892 | r79893 >
Date:12:46, 9 January 2011
Author:nikerabbit
Status:reverted (Comments)
Tags:
Comment:
* (bug 25506) Exception is thrown if OutputPage::parse is called inside a tag hook, which would reset parser state
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/OutputPage.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/OutputPage.php
@@ -1187,6 +1187,13 @@
11881188 * @return String: HTML
11891189 */
11901190 public function parse( $text, $linestart = true, $interface = false, $language = null ) {
 1191+ // Check one for one common cause for parser state resetting
 1192+ $callers = wfGetAllCallers( 10 );
 1193+ if ( strpos( $callers, 'Parser::extensionSubstitution' ) !== false ) {
 1194+ throw new MWException( "wfMsg* function with parsing cannot be used " .
 1195+ "inside a tag hook. Should use parser->recursiveTagParse() instead" );
 1196+ }
 1197+
11911198 global $wgParser;
11921199
11931200 if( is_null( $this->getTitle() ) ) {
Index: trunk/phase3/RELEASE-NOTES
@@ -68,6 +68,8 @@
6969 * If an edit summary exceeds 250 bytes and is truncated, add an ellipse
7070 * (bug 26638) Database error pages display correctly in RTL languages
7171 * (bug 26187) Confirmrecreate no longer parses the edit summary
 72+* (bug 25506) Exception is thrown if OutputPage::parse is called inside a tag hook,
 73+ which would reset parser state
7274
7375 === API changes in 1.18 ===
7476 * (bug 26339) Throw warning when truncating an overlarge API result

Follow-up revisions

RevisionCommit summaryAuthorDate
r94738Self-revert r79892: only got one opposition and apparently too hairy for anyo...nikerabbit09:55, 17 August 2011
r95632MFT to REL1_18...hashar17:57, 28 August 2011

Comments

#Comment by Platonides (talk | contribs)   14:41, 29 January 2011

You want to use a different parser, not recursiveTagParse(). And it's something wfMsg* functions should have automatically done.

Breaks the r74698 workaround of creating a new $wgParser.

#Comment by Nikerabbit (talk | contribs)   22:28, 29 January 2011

Why is that extension doing parsing there??

#Comment by Platonides (talk | contribs)   00:06, 30 January 2011

article-comments-comment-contents defines the comment surroundings. It makes sense to allow wikitext there.

It could be replaced with $parser->recursiveTagParse( wfMsgReplaceArgs( wfMsgGetKey( 'article-comments-comment-contents', true, true ) , array( $args['name'], $args['url'], $args['signature'], $args['date'], $text ) ), $frame ); but seems more robust (and less ugly) this way.

#Comment by Nikerabbit (talk | contribs)   09:30, 20 June 2011

Should this be reverted then?

#Comment by Siebrand (talk | contribs)   22:04, 28 July 2011

Apparently yes

#Comment by Siebrand (talk | contribs)   15:35, 15 July 2011

Ping

Status & tagging log