On 09-09-2010 00:08, Tim Starling wrote:
Parser::clearState() should be enough to fix this (or calling some parser method that calls clearState()), and that's what MessageCache::transform() relies on when it clones the parser. Parser::clearState() has some special hacks in it to clean up after a clone.
This is good to know. I have a similar problem in Extension:Wikilog. It needs a separate parser to generate Atom/RSS feeds, which have several restrictions (all URLs must be absolute, TOCs must not be generated, etc.).
Currently, it has two options: either cloning $wgParser (the default) or creating a new Parser object. The problem with the second option is that there are way too many broken extensions that initialize $wgParser directly instead of the $parser parameter from the ParserFirstCallInit hook.
With this information now, I may consider settling with a $wgParser clone to satisfy these needs.
Regards,