Yeah, newChild() expects a preprocessor node instance (rather than the raw arguments array
itself) for the arguments, which can be obtained by calling
Preprocessor::newPartNodeArray() with the given set of arguments.
For Parsoid-PHP and the potential upgrade work it requires, it is probably something that
will need to be addressed eventually, but from what I understand, there’s plenty of time
until then, so it should not be an immediate concern. :)
Sr. Software Engineer
he - him - his
Fandom Poland sp. z o.o. z siedzibą w Poznaniu, ul. Abp. A. Baraniaka 6
Sąd Rejonowy Poznań – Nowe Miasto i Wilda w Poznaniu, VIII Wydział Gospodarczy Krajowego
Rejestru Sądowego, KRS 0000254365
Kapitał zakładowy: 50.000,00 złotych
On 8 Apr 2021, at 02:44, Mark Clements (HappyDog)
"M�t� Szab�" <mszabo(a)wikia-inc.com> wrote in message
I know it's been a while, but I've only now found some time to work on this
in any depth.
The DOM-based wikitext preprocessor
(Preprocessor_DOM class and friends)
was deprecated in MediaWiki 1.34 and removed in MediaWiki 1.35 as part of
the Wikimedia Parsing Team's work around Parsoid-PHP.
I guess that explains why things changed in MW 1.34, specifically.
In the short/medium term, the easiest fix to keep
your code working would
use the other preprocessor implementation (class Preprocessor_Hash and
I think this is what I have now done. The solution I implemented was to
replace the following line:
$NewFrame = new PPTemplateFrame_DOM($Frame->preprocessor,
$Frame, array(), $Vars,
if (is_a($Frame, "PPFrame_Hash"))
$TemplateFrameClass = "PPTemplateFrame_Hash";
$TemplateFrameClass = "PPTemplateFrame_DOM";
$NewFrame = new $TemplateFrameClass($Frame->preprocessor,
$Frame, array(), $Vars,
This seems to work on both MW versions I am testing on (1.29 and 1.34) and
fits-in with your explanation, above.
Since your code already has access to a PPFrame
you can also try invoking its newChild() method to construct a
new child frame with your arguments, instead of creating the
I couldn't get this to work. I needed to pass additional arguments into the
constructor, but got an error if I passed in an array of string => string
pairs and there was no documentation about how to convert such an array into
a format that the function would accept, so I gave up on this approach.
In the long term, the legacy wikitext
preprocessor will be removed, so
you may want to reach out to the Parsing Team to find out how you
can make your code ready for Parsoid-PHP.
Based on that comment, I suspect that further upgrade work will be required
in due course, but at least I have solved the immediate problem.... for now!
Thanks for your help,
- Mark Clements
Wikitech-l mailing list