This is expected. You should not make assumptions about the state of the global Parser instance in a special page. In some circumstances (especially transclusions) it might be in a parse, other times it won't be.
If you're rendering an i18n message, its better to use ->parse() of the Message class then to pass it through the parser directly. Alternatively use \MediaWiki\MediaWikiServices::getInstance()->getParser()->getFreshParser() and then initialize it yourself by calling ->parse() on the Parser, so you always know what the state is for sure. -- Brian On Fri, Jun 11, 2021 at 9:27 AM Sebastian Trueg <tr...@truegeex.de> wrote: > Hi everyone, > > my skin uses the global parser in order to render some parts of the > navigation bar via templates (Parser::recursivePreprocess). This works > fine on all normal pages (and even some special ones like > Special:Version), but not on special pages like Special:AllPages. > > Some debugging revealed that on Special:AllPages the global parser > object (\MediaWiki\MediaWikiServices::getInstance()->getParser()) is not > properly initialized. Member variables like mOptions and mTitle are null > which results in tons of NPEs. > > Any idea why that is? Is that a bug or am I mis-using the parser? > > Regards, > Sebastian > _______________________________________________ > MediaWiki-l mailing list -- mediawiki-l@lists.wikimedia.org > List information: > https://lists.wikimedia.org/postorius/lists/mediawiki-l.lists.wikimedia.org/ >
_______________________________________________ MediaWiki-l mailing list -- mediawiki-l@lists.wikimedia.org List information: https://lists.wikimedia.org/postorius/lists/mediawiki-l.lists.wikimedia.org/