Last modified: 2011-04-14 15:12:06 UTC

Wikimedia Bugzilla is closed!

Wikimedia has migrated from Bugzilla to Phabricator. Bug reports should be created and updated in Wikimedia Phabricator instead. Please create an account in Phabricator and add your Bugzilla email address to it.
Wikimedia Bugzilla is read-only. If you try to edit or create any bug report in Bugzilla you will be shown an intentional error message.
In order to access the Phabricator task corresponding to a Bugzilla report, just remove "static-" from its URL.
You could still run searches in Bugzilla or access your list of votes but bug reports will obviously not be up-to-date in Bugzilla.
Bug 9762 - addWikiText breaks multiply transcluded specialpages
addWikiText breaks multiply transcluded specialpages
Status: NEW
Product: MediaWiki
Classification: Unclassified
Parser (Other open bugs)
All All
: Low normal (vote)
: ---
Assigned To: Nobody - You can work on this!
Depends on: 17329
  Show dependency treegraph
Reported: 2007-05-02 11:20 UTC by Darren Edmundson
Modified: 2011-04-14 15:12 UTC (History)
1 user (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Description Darren Edmundson 2007-05-02 11:20:59 UTC
If you have a specialpage which uses $wgOut->addWikiText(), as recommended on
.3EaddWikiText.28.29 , and that page is transcluded into a page more than once 
(or two such pages are transcluded, etc), then all but the last transclusion 
are displayed as the "\07UNIQ-" replacement token rather than the page output.

This appears to be caused by OutputPage::addWikiText requesting the parser 
state be cleared after execution, removing the earlier transcluded HTML from 
the replacement table before it's actually substituted in the document.

As a workaround for my own use, I've written my own MySpecialPage->addWikiText
() which doesn't clear the state (but may well break other things) - but if 
this is the preferred(/documented) way of writing special pages, then it may 
need fixing for other people too.

I first saw this when trying to transclude multiple different subpages of my 
IncludableSpecialPage, but have since confirmed it happens in the more general 
case. Predictably $wgOut->addHTML() does not cause this problem as the parser 
is not invoked.
Comment 1 Mathias Ertl 2008-02-03 14:56:36 UTC
Probably the cleanest way for getting around this bug without losing the ability to use wiki syntax is writing your own small function that looks something like this:
 function addText( $text ) {
         global $wgTitle, $wgOut, $wgParser;
         $po = $wgParser->parse( $text, $wgTitle, $wgParser->mOptions, false, false );
         $wgOut->addHTML( $po->getText() );

Then simply use this function instead of addWikiText.
Comment 2 Brion Vibber 2008-02-04 19:19:23 UTC
Just use wfMsgExt with the parse option.

Note You need to log in before you can comment on or make changes to this bug.