Page MenuHomePhabricator

IndexFunction uses deprecated direct access to PHP properties on ParserOutput
Closed, DeclinedPublic

Description

I tried to rebase my patch, and the quibble-vendor-mysql-php72-selenium-docker test has failed because of this:

2021-10-16 19:13:13 e16b91f541fe wikidb: [f5ddf8ac5c4e83d373cc2c7c] /index.php/Main_Page   PHP Deprecated: ParserOutput::mIndexes dynamic property write access deprecated [Called from IndexFunctionHooks::doIndexes]
#0 [internal function]: MWExceptionHandler::handleError(integer, string, string, string, array)
#1 /workspace/src/includes/debug/MWDebug.php(375): trigger_error(string, integer)
#2 /workspace/src/includes/debug/MWDebug.php(351): MWDebug::sendRawDeprecated(string, boolean, string)
#3 /workspace/src/includes/GlobalFunctions.php(1030): MWDebug::deprecatedMsg(string, string, string, integer)
#4 /workspace/src/includes/parser/ParserOutput.php(2121): wfDeprecatedMsg(string, string)
#5 /workspace/src/extensions/IndexFunction/IndexFunctionHooks.php(156): ParserOutput->__set(string, array)
#6 /workspace/src/includes/HookContainer/HookContainer.php(338): IndexFunctionHooks::doIndexes(OutputPage, ParserOutput)
#7 /workspace/src/includes/HookContainer/HookContainer.php(137): MediaWiki\HookContainer\HookContainer->callLegacyHook(string, array, array, array)
#8 /workspace/src/includes/HookContainer/HookRunner.php(2679): MediaWiki\HookContainer\HookContainer->run(string, array, array)
#9 /workspace/src/includes/OutputPage.php(1980): MediaWiki\HookContainer\HookRunner->onOutputPageParserOutput(OutputPage, ParserOutput)
#10 /workspace/src/includes/OutputPage.php(2028): OutputPage->addParserOutputMetadata(ParserOutput)
#11 /workspace/src/includes/page/Article.php(793): OutputPage->addParserOutput(ParserOutput, array)
#12 /workspace/src/includes/page/Article.php(704): Article->doOutputFromRenderStatus(MediaWiki\Revision\RevisionStoreRecord, Status, OutputPage, array)
#13 /workspace/src/includes/page/Article.php(509): Article->generateContentOutput(User, ParserOptions, integer, OutputPage, array)
#14 /workspace/src/includes/actions/ViewAction.php(74): Article->view()
#15 /workspace/src/includes/MediaWiki.php(538): ViewAction->show()
#16 /workspace/src/includes/MediaWiki.php(320): MediaWiki->performAction(Article, Title)
#17 /workspace/src/includes/MediaWiki.php(925): MediaWiki->performRequest()
#18 /workspace/src/includes/MediaWiki.php(559): MediaWiki->main()
#19 /workspace/src/index.php(53): MediaWiki->run()
#20 /workspace/src/index.php(46): wfIndexMain()
#21 {main}
2021-10-16 19:13:13 e16b91f541fe wikidb: [f5ddf8ac5c4e83d373cc2c7c] /index.php/Main_Page   PHP Deprecated: Use of ParserOutput::getProperty was deprecated in MediaWiki 1.38. [Called from IndexFunctionHooks::doIndexes]
#0 [internal function]: MWExceptionHandler::handleError(integer, string, string, string, array)
#1 /workspace/src/includes/debug/MWDebug.php(375): trigger_error(string, integer)
#2 /workspace/src/includes/debug/MWDebug.php(351): MWDebug::sendRawDeprecated(string, boolean, string)
#3 /workspace/src/includes/debug/MWDebug.php(230): MWDebug::deprecatedMsg(string, string, string, integer)
#4 /workspace/src/includes/GlobalFunctions.php(1005): MWDebug::deprecated(string, string, string, integer)
#5 /workspace/src/includes/parser/ParserOutput.php(1185): wfDeprecated(string, string)
#6 /workspace/src/extensions/IndexFunction/IndexFunctionHooks.php(159): ParserOutput->getProperty(string)
#7 /workspace/src/includes/HookContainer/HookContainer.php(338): IndexFunctionHooks::doIndexes(OutputPage, ParserOutput)
#8 /workspace/src/includes/HookContainer/HookContainer.php(137): MediaWiki\HookContainer\HookContainer->callLegacyHook(string, array, array, array)
#9 /workspace/src/includes/HookContainer/HookRunner.php(2679): MediaWiki\HookContainer\HookContainer->run(string, array, array)
#10 /workspace/src/includes/OutputPage.php(1980): MediaWiki\HookContainer\HookRunner->onOutputPageParserOutput(OutputPage, ParserOutput)
#11 /workspace/src/includes/OutputPage.php(2028): OutputPage->addParserOutputMetadata(ParserOutput)
#12 /workspace/src/includes/page/Article.php(793): OutputPage->addParserOutput(ParserOutput, array)
#13 /workspace/src/includes/page/Article.php(704): Article->doOutputFromRenderStatus(MediaWiki\Revision\RevisionStoreRecord, Status, OutputPage, array)
#14 /workspace/src/includes/page/Article.php(509): Article->generateContentOutput(User, ParserOptions, integer, OutputPage, array)
#15 /workspace/src/includes/actions/ViewAction.php(74): Article->view()
#16 /workspace/src/includes/MediaWiki.php(538): ViewAction->show()
#17 /workspace/src/includes/MediaWiki.php(320): MediaWiki->performAction(Article, Title)
#18 /workspace/src/includes/MediaWiki.php(925): MediaWiki->performRequest()
#19 /workspace/src/includes/MediaWiki.php(559): MediaWiki->main()
#20 /workspace/src/index.php(53): MediaWiki->run()
#21 /workspace/src/index.php(46): wfIndexMain()
#22 {main}
2021-10-16 19:13:19 e16b91f541fe wikidb: [e1ff9a2e51e9a4fe0aa3e328] /index.php/Main_Page   PHP Deprecated: ParserOutput::mIndexes dynamic property write access deprecated [Called from IndexFunctionHooks::doIndexes]
#0 [internal function]: MWExceptionHandler::handleError(integer, string, string, string, array)
#1 /workspace/src/includes/debug/MWDebug.php(375): trigger_error(string, integer)
#2 /workspace/src/includes/debug/MWDebug.php(351): MWDebug::sendRawDeprecated(string, boolean, string)
#3 /workspace/src/includes/GlobalFunctions.php(1030): MWDebug::deprecatedMsg(string, string, string, integer)
#4 /workspace/src/includes/parser/ParserOutput.php(2121): wfDeprecatedMsg(string, string)
#5 /workspace/src/extensions/IndexFunction/IndexFunctionHooks.php(156): ParserOutput->__set(string, array)
#6 /workspace/src/includes/HookContainer/HookContainer.php(338): IndexFunctionHooks::doIndexes(OutputPage, ParserOutput)
#7 /workspace/src/includes/HookContainer/HookContainer.php(137): MediaWiki\HookContainer\HookContainer->callLegacyHook(string, array, array, array)
#8 /workspace/src/includes/HookContainer/HookRunner.php(2679): MediaWiki\HookContainer\HookContainer->run(string, array, array)
#9 /workspace/src/includes/OutputPage.php(1980): MediaWiki\HookContainer\HookRunner->onOutputPageParserOutput(OutputPage, ParserOutput)
#10 /workspace/src/includes/OutputPage.php(2028): OutputPage->addParserOutputMetadata(ParserOutput)
#11 /workspace/src/includes/page/Article.php(748): OutputPage->addParserOutput(ParserOutput, array)
#12 /workspace/src/includes/page/Article.php(602): Article->doOutputFromParserCache(ParserOutput, OutputPage, array)
#13 /workspace/src/includes/page/Article.php(509): Article->generateContentOutput(User, ParserOptions, integer, OutputPage, array)
#14 /workspace/src/includes/actions/ViewAction.php(74): Article->view()
#15 /workspace/src/includes/MediaWiki.php(538): ViewAction->show()
#16 /workspace/src/includes/MediaWiki.php(320): MediaWiki->performAction(Article, Title)
#17 /workspace/src/includes/MediaWiki.php(925): MediaWiki->performRequest()
#18 /workspace/src/includes/MediaWiki.php(559): MediaWiki->main()
#19 /workspace/src/index.php(53): MediaWiki->run()
#20 /workspace/src/index.php(46): wfIndexMain()
#21 {main}
2021-10-16 19:13:19 e16b91f541fe wikidb: [e1ff9a2e51e9a4fe0aa3e328] /index.php/Main_Page   PHP Deprecated: Use of ParserOutput::getProperty was deprecated in MediaWiki 1.38. [Called from IndexFunctionHooks::doIndexes]
#0 [internal function]: MWExceptionHandler::handleError(integer, string, string, string, array)
#1 /workspace/src/includes/debug/MWDebug.php(375): trigger_error(string, integer)
#2 /workspace/src/includes/debug/MWDebug.php(351): MWDebug::sendRawDeprecated(string, boolean, string)
#3 /workspace/src/includes/debug/MWDebug.php(230): MWDebug::deprecatedMsg(string, string, string, integer)
#4 /workspace/src/includes/GlobalFunctions.php(1005): MWDebug::deprecated(string, string, string, integer)
#5 /workspace/src/includes/parser/ParserOutput.php(1185): wfDeprecated(string, string)
#6 /workspace/src/extensions/IndexFunction/IndexFunctionHooks.php(159): ParserOutput->getProperty(string)
#7 /workspace/src/includes/HookContainer/HookContainer.php(338): IndexFunctionHooks::doIndexes(OutputPage, ParserOutput)
#8 /workspace/src/includes/HookContainer/HookContainer.php(137): MediaWiki\HookContainer\HookContainer->callLegacyHook(string, array, array, array)
#9 /workspace/src/includes/HookContainer/HookRunner.php(2679): MediaWiki\HookContainer\HookContainer->run(string, array, array)
#10 /workspace/src/includes/OutputPage.php(1980): MediaWiki\HookContainer\HookRunner->onOutputPageParserOutput(OutputPage, ParserOutput)
#11 /workspace/src/includes/OutputPage.php(2028): OutputPage->addParserOutputMetadata(ParserOutput)
#12 /workspace/src/includes/page/Article.php(748): OutputPage->addParserOutput(ParserOutput, array)
#13 /workspace/src/includes/page/Article.php(602): Article->doOutputFromParserCache(ParserOutput, OutputPage, array)
#14 /workspace/src/includes/page/Article.php(509): Article->generateContentOutput(User, ParserOptions, integer, OutputPage, array)
#15 /workspace/src/includes/actions/ViewAction.php(74): Article->view()
#16 /workspace/src/includes/MediaWiki.php(538): ViewAction->show()
#17 /workspace/src/includes/MediaWiki.php(320): MediaWiki->performAction(Article, Title)
#18 /workspace/src/includes/MediaWiki.php(925): MediaWiki->performRequest()
#19 /workspace/src/includes/MediaWiki.php(559): MediaWiki->main()
#20 /workspace/src/index.php(53): MediaWiki->run()
#21 /workspace/src/index.php(46): wfIndexMain()
#22 {main}

Event Timeline

Change 762080 had a related patch set uploaded (by Umherirrender; author: Umherirrender):

[mediawiki/extensions/IndexFunction@master] Replaced deprecated Parser::getProperty

https://gerrit.wikimedia.org/r/762080

Yeah, setting properties directly on ParserOutput is deprecated and I don't think is supported in WMF production any more. You should use setExtensionData and appendExtensionData, which were added for that purpose.

Change 762080 merged by Umherirrender:

[mediawiki/extensions/IndexFunction@master] Replaced deprecated ParserOutput::getProperty

https://gerrit.wikimedia.org/r/762080

cscott renamed this task from quibble-vendor-mysql-php72-selenium-docker for IndexFunction fails to IndexFunction uses deprecated direct access to PHP properties on ParserOutput.Mar 31 2022, 3:41 PM