[dokuwiki] Re: Multiple parser instances and PARSER_WIKITEXT_PREPROCESS

  • From: TNHarris <telliamed@xxxxxxxxxxx>
  • To: dokuwiki@xxxxxxxxxxxxx
  • Date: Tue, 28 Dec 2010 18:41:18 -0500

On 12/26/2010 06:35 PM, Michael Hamann wrote:

I think the problem is that p_get_parsermodes() uses a static array to
cache the modes. Thus you get the exactly same mode objects as
p_get_instructions gets. $parser->addMode() now sets the "Lexer"
attribute of each mode which is probably what causes these problems.
Some print_r() statements have confirmed my assumptions, the problem is
that PHP returns objects by reference so we have the same mode objects
in all parsers but different lexer objects.


Thanks for looking into this.

Okay, I see it now. Would it be solved by removing the explicit reference operators from $Mode in Doku_Parser::addMode? PHP objects are normally copy-on-write (I think), so setting the Lexer reference will copy each mode object for that instance of the parser (maybe?).

--
- tom
telliamed@xxxxxxxxxxxxx
--
DokuWiki mailing list - more info at
http://www.dokuwiki.org/mailinglist

Other related posts: