Page MenuHomePhabricator

Error from line 205 of "TemplateStylesHooks.php": Call to a member function clear() on null
Closed, DuplicatePublic

Description

Setup

  • MediaWiki 1.32.0 (8a2f437) 00:17, 10. Feb. 2019
  • PHP 7.0.33-0+deb9u1 (apache2handler)
  • MariaDB 10.1.37-MariaDB-0+deb9u1
  • TemplateStyles 1.0 (c3410ae) 17:10, 16. Okt. 2018

Issue

[693bc20974b96c4b0a79b163] /wiki/Main_Page Error from line 205 of /../w/extensions/TemplateStyles/includes/TemplateStylesHooks.php: Call to a member function clear() on null

Backtrace

#0 /../w/includes/Hooks.php(174): TemplateStylesHooks::onParserClearState(Parser)
#1 /../w/includes/Hooks.php(202): Hooks::callHook(string, array, array, NULL)
#2 /../w/includes/parser/Parser.php(420): Hooks::run(string, array)
#3 /../w/includes/parser/Parser.php(4774): Parser->clearState()
#4 /../w/includes/parser/Parser.php(728): Parser->startParse(Title, ParserOptions, integer, boolean)
#5 /../w/includes/parser/Parser.php(4800): Parser->preprocess(string, Title, ParserOptions)
#6 /../w/includes/cache/MessageCache.php(1174): Parser->transformMsg(string, ParserOptions, Title)
#7 /../w/includes/Message.php(1282): MessageCache->transform(string, boolean, Language, Title)
#8 /../w/includes/Message.php(883): Message->transformText(string)
#9 /../w/includes/Message.php(943): Message->toString(string)
#10 /../w/includes/OutputPage.php(924): Message->text()
#11 /../w/includes/OutputPage.php(971): OutputPage->setHTMLTitle(Message)
#12 /../w/includes/OutputPage.php(2742): OutputPage->setPageTitle(string)
#13 /../w/includes/exception/MWExceptionRenderer.php(127): OutputPage->prepareErrorPage(string)
#14 /../w/includes/exception/MWExceptionRenderer.php(53): MWExceptionRenderer::reportHTML(TypeError)
#15 /../w/includes/exception/MWExceptionHandler.php(98): MWExceptionRenderer::output(TypeError, integer)
#16 /../w/includes/exception/MWExceptionHandler.php(172): MWExceptionHandler::report(TypeError)
#17 /../w/includes/MediaWiki.php(547): MWExceptionHandler::handleException(TypeError)
#18 /../w/index.php(42): MediaWiki->run()

Event Timeline

So far this happened only once. It was a bit weird since I upgraded the code of a completely different extension and all of a sudden ran into this issue. Moreover I was not telling the whole story in my report. :( The PHP warning was preceded by PHP notices and a fatal:

Notice: Undefined property: Parser::$extTemplateStylesCache in /../w/extensions/TemplateStyles/includes/TemplateStylesHooks.php on line 205
Notice: Undefined property: Parser::$extTemplateStylesCache in /../w/extensions/TemplateStyles/includes/TemplateStylesHooks.php on line 205
Fatal error: Uncaught Error: Call to a member function clear() on null in /../w/extensions/TemplateStyles/includes/TemplateStylesHooks.php:205

Stack trace

#0 /../w/includes/Hooks.php(174): TemplateStylesHooks::onParserClearState(Object(Parser))
#1 /../w/includes/Hooks.php(202): Hooks::callHook('ParserClearStat...', Array, Array, NULL)
#2 /../w/includes/parser/Parser.php(420): Hooks::run('ParserClearStat...', Array)
#3 /../w/includes/parser/Parser.php(4774): Parser->clearState()
#4 /../w/includes/parser/Parser.php(450): Parser->startParse(Object(Title), Object(ParserOptions), 1, true)
#5 /../w/includes/OutputPage.php(2218): Parser->parse('Currently this ...', Object(Title), Object(ParserOptions), true, true, NULL)
#6 /../w/includes/OutputPage.php(2097): OutputPage->parseInternal('Currently this ...', Object(Title), true, false, false, NULL)
#7 /var/www/htdo in /../w/extensions/TemplateStyles/includes/TemplateStylesHooks.php on line 205

After about ten minutes of me panicking the wiki was back on-line.

Let's just continue ignoring this then :) Has something to do with updates and cached data (incompatible parser cache version maybe?), not worth the effort tracking down IMO if it is a one-time thing.

Let's just continue ignoring this then :) Has something to do with updates and cached data (incompatible parser cache version maybe?), not worth the effort tracking down IMO if it is a one-time thing.

I am fine with this. The only thing that makes me worried a bit is that it happened out of the blue meaning at an arbitrary point in time. The respective wiki was upgraded to MW 1.32.0 on January 11 together with this extension that went to REL1_32 at the same time. This issues happened on February 9, 2019. The only thing that changed is the revision used for REL1_32 of MediaWiki (I update core branch daily), meaning that only one the the commits on February 5, 6 or 7 to REL1_32 could have triggered it since these are the only changes between the last update of an extension and the update to an arbitrary extension that caused it.