Page MenuHomePhabricator

Scribunto's use of dynamic Parser::$scribunto_engine should be rewritten/removed
Open, Needs TriagePublic

Description

There's no guarantee on identity on the specific parser objects used during article pass. With both async fragment rendering as well as the Parsoid/Parser migration (which may cause different parts of the page to be variously rendered using the new Parsoid or legacy parser), the actual Parser objects seen may be different for different instances of an extension tag on the same page.

When PHP 8.2 disallowed dynamic property creation, the following error was given (T324891):

Deprecated: Creation of dynamic property Parser::$scribunto_engine is deprecated in /var/www/wiki/mediawiki/extensions/Scribunto/includes/Hooks.php on line 99

Deprecated: Creation of dynamic property Parser::$scribunto_engine is deprecated in /var/www/wiki/mediawiki/extensions/Scribunto/includes/Scribunto.php on line 62

This was "fixed" by allowing dynamic properties on the Parser class, but this fix should eventually be reverted once the underlying usage in Scribunto is removed.

We can potentially have a short term cache to reuse the scribunto engine between modules "as available" but this can't be guaranteed in all cases: in an async parse or in the case of a context switch between Parsoid and the legacy parser the previous engine object may not be available. Communication between scribunto invocations on the same page should be discouraged, or mediated through a ParserOutput object (which implies that the state should be serializable).

Event Timeline