Page MenuHomePhabricator

PHP Deprecated: Use of ParserOutput::setProperty was deprecated in MediaWiki 1.38. [Called from Wikibase\Client\Hooks\ShortDescHandler::doHandle]
Closed, ResolvedPublicPRODUCTION ERROR

Description

Error

Deprecated usage of ParserOutput::getProperty and ParserOutput::setProperty in extensions/Wikibase/client/includes/Hooks/ShortDescHandler.php(94)

ParserOutput::setProperty

normalized_message
[{reqId}] {exception_url}   PHP Deprecated: Use of ParserOutput::setProperty was deprecated in MediaWiki 1.38. [Called from Wikibase\Client\Hooks\ShortDescHandler::doHandle]
exception.trace
from /srv/mediawiki/php-1.38.0-wmf.5/extensions/Wikibase/client/includes/Hooks/ShortDescHandler.php(94)
#0 [internal function]: MWExceptionHandler::handleError(integer, string, string, string, array)
#1 /srv/mediawiki/php-1.38.0-wmf.5/includes/debug/MWDebug.php(375): trigger_error(string, integer)
#2 /srv/mediawiki/php-1.38.0-wmf.5/includes/debug/MWDebug.php(351): MWDebug::sendRawDeprecated(string, boolean, string)
#3 /srv/mediawiki/php-1.38.0-wmf.5/includes/debug/MWDebug.php(230): MWDebug::deprecatedMsg(string, string, string, integer)
#4 /srv/mediawiki/php-1.38.0-wmf.5/includes/GlobalFunctions.php(1005): MWDebug::deprecated(string, string, string, integer)
#5 /srv/mediawiki/php-1.38.0-wmf.5/includes/parser/ParserOutput.php(1171): wfDeprecated(string, string)
#6 /srv/mediawiki/php-1.38.0-wmf.5/extensions/Wikibase/client/includes/Hooks/ShortDescHandler.php(94): ParserOutput->setProperty(string, string)
#7 /srv/mediawiki/php-1.38.0-wmf.5/extensions/Wikibase/client/includes/Hooks/ShortDescHandler.php(26): Wikibase\Client\Hooks\ShortDescHandler->doHandle(Parser, string, string)
#8 /srv/mediawiki/php-1.38.0-wmf.5/includes/parser/Parser.php(3398): Wikibase\Client\Hooks\ShortDescHandler::handle(Parser, string)
#9 /srv/mediawiki/php-1.38.0-wmf.5/includes/parser/Parser.php(3081): Parser->callParserFunction(PPFrame_Hash, string, array)
#10 /srv/mediawiki/php-1.38.0-wmf.5/includes/parser/PPFrame_Hash.php(276): Parser->braceSubstitution(array, PPFrame_Hash)
#11 /srv/mediawiki/php-1.38.0-wmf.5/includes/parser/Parser.php(2917): PPFrame_Hash->expand(PPNode_Hash_Tree, integer)
#12 /srv/mediawiki/php-1.38.0-wmf.5/includes/parser/Parser.php(936): Parser->replaceVariables(string, PPFrame_Hash)
#13 /srv/mediawiki/php-1.38.0-wmf.5/includes/api/ApiExpandTemplates.php(145): Parser->preprocess(string, Title, ParserOptions, NULL, PPFrame_Hash)
#14 /srv/mediawiki/php-1.38.0-wmf.5/includes/api/ApiMain.php(1878): ApiExpandTemplates->execute()
#15 /srv/mediawiki/php-1.38.0-wmf.5/includes/api/ApiMain.php(857): ApiMain->executeAction()
#16 /srv/mediawiki/php-1.38.0-wmf.5/includes/api/ApiMain.php(828): ApiMain->executeActionWithErrorHandling()
#17 /srv/mediawiki/php-1.38.0-wmf.5/api.php(90): ApiMain->execute()
#18 /srv/mediawiki/php-1.38.0-wmf.5/api.php(45): wfApiMain()
#19 /srv/mediawiki/w/api.php(3): require(string)
#20 {main}

ParserOutput::getProperty

normalized_message
[{reqId}] {exception_url}   PHP Deprecated: Use of ParserOutput::getProperty was deprecated in MediaWiki 1.38. [Called from Wikibase\Client\Hooks\ShortDescHandler::doHandle]
exception.trace
from /srv/mediawiki/php-1.38.0-wmf.5/extensions/Wikibase/client/includes/Hooks/ShortDescHandler.php(88)
#0 [internal function]: MWExceptionHandler::handleError(integer, string, string, string, array)
#1 /srv/mediawiki/php-1.38.0-wmf.5/includes/debug/MWDebug.php(375): trigger_error(string, integer)
#2 /srv/mediawiki/php-1.38.0-wmf.5/includes/debug/MWDebug.php(351): MWDebug::sendRawDeprecated(string, boolean, string)
#3 /srv/mediawiki/php-1.38.0-wmf.5/includes/debug/MWDebug.php(230): MWDebug::deprecatedMsg(string, string, string, integer)
#4 /srv/mediawiki/php-1.38.0-wmf.5/includes/GlobalFunctions.php(1005): MWDebug::deprecated(string, string, string, integer)
#5 /srv/mediawiki/php-1.38.0-wmf.5/includes/parser/ParserOutput.php(1185): wfDeprecated(string, string)
#6 /srv/mediawiki/php-1.38.0-wmf.5/extensions/Wikibase/client/includes/Hooks/ShortDescHandler.php(88): ParserOutput->getProperty(string)
#7 /srv/mediawiki/php-1.38.0-wmf.5/extensions/Wikibase/client/includes/Hooks/ShortDescHandler.php(26): Wikibase\Client\Hooks\ShortDescHandler->doHandle(Parser, string, string)
#8 /srv/mediawiki/php-1.38.0-wmf.5/includes/parser/Parser.php(3398): Wikibase\Client\Hooks\ShortDescHandler::handle(Parser, string)
#9 /srv/mediawiki/php-1.38.0-wmf.5/includes/parser/Parser.php(3081): Parser->callParserFunction(PPFrame_Hash, string, array)
#10 /srv/mediawiki/php-1.38.0-wmf.5/includes/parser/PPFrame_Hash.php(276): Parser->braceSubstitution(array, PPFrame_Hash)
#11 /srv/mediawiki/php-1.38.0-wmf.5/includes/parser/Parser.php(2917): PPFrame_Hash->expand(PPNode_Hash_Tree, integer)
#12 /srv/mediawiki/php-1.38.0-wmf.5/includes/parser/Parser.php(936): Parser->replaceVariables(string, PPFrame_Hash)
#13 /srv/mediawiki/php-1.38.0-wmf.5/includes/api/ApiExpandTemplates.php(145): Parser->preprocess(string, Title, ParserOptions, NULL, PPFrame_Hash)
#14 /srv/mediawiki/php-1.38.0-wmf.5/includes/api/ApiMain.php(1878): ApiExpandTemplates->execute()
#15 /srv/mediawiki/php-1.38.0-wmf.5/includes/api/ApiMain.php(857): ApiMain->executeAction()
#16 /srv/mediawiki/php-1.38.0-wmf.5/includes/api/ApiMain.php(828): ApiMain->executeActionWithErrorHandling()
#17 /srv/mediawiki/php-1.38.0-wmf.5/api.php(90): ApiMain->execute()
#18 /srv/mediawiki/php-1.38.0-wmf.5/api.php(45): wfApiMain()
#19 /srv/mediawiki/w/api.php(3): require(string)
#20 {main}
Impact
Notes

Event Timeline

Why were getProperty() and setProperty() hard-deprecated when there are still callers in production-deployed extensions that can easily be found with codesearch?

Change 732272 had a related patch set uploaded (by Lucas Werkmeister (WMDE); author: Lucas Werkmeister (WMDE)):

[mediawiki/extensions/Wikibase@master] Update deprecated calls in ShortDescHandler

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

Okay, maybe not “easily”, given that OutputPage has similar methods that weren’t renamed, and in the codesearch context it’s not immediately obvious if an $out variable is a ParserOutput or an OutputPage.

That has been deprecated as part of T287216: ParserOutput should implement ContentMetadataCollector specially by https://gerrit.wikimedia.org/r/c/mediawiki/core/+/727402 . A code search has definitely been done and the patch has a bunch of Depends-On.

There was a patch for Wikibase https://gerrit.wikimedia.org/r/c/mediawiki/extensions/Wikibase/+/727403 and I guess after that another change introduced ParserOutput:getProperty before the hard deprecation patch got merged in core? Though CI should have caught when attempting to merge the mediawiki/core patch. So I don't quite know :-\

Okay, maybe not “easily”, given that OutputPage has similar methods that weren’t renamed, and in the codesearch context it’s not immediately obvious if an $out variable is a ParserOutput or an OutputPage.

This. It's quite hard to tell the difference between OutputPage and ParserOutput and apparently I missed a few. My apologies!

I'll note that one motivation for the change is to more clearly distinguish page properties (which are db-backed) from the similar OutputPage properties.

Yeah, I didn’t realize the two classes were so confusingly similar, sorry for being a bit too harsh there. (I did a quick git grep and just assumed most of them would be other ParserOutput calls, since they were on variables like $out.)

Change 732354 had a related patch set uploaded (by C. Scott Ananian; author: C. Scott Ananian):

[mediawiki/extensions/Wikibase@master] Rename usages of deprecated ParserOutput::{get,set}Property() (take 2)

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

(Also, just sayin': this would have been caught by CI if ShortDescHandler::doHandle() were covered by any tests...)

Change 732355 had a related patch set uploaded (by C. Scott Ananian; author: C. Scott Ananian):

[mediawiki/extensions/Wikibase@master] Rename ParserOutput and OutputPage variables to disambiguate

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

It is covered by tests, the tests just happen to mock the parser output instead of using the real implementation.

Change 732354 abandoned by C. Scott Ananian:

[mediawiki/extensions/Wikibase@master] Rename usages of deprecated ParserOutput::{get,set}Property() (take 2)

Reason:

Abandon in favor of I70706415ae657f6783b7ae78e2dbe1b96ca31dbe

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

Change 732332 had a related patch set uploaded (by C. Scott Ananian; author: Lucas Werkmeister (WMDE)):

[mediawiki/extensions/Wikibase@wmf/1.38.0-wmf.5] Update deprecated calls in ShortDescHandler

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

Change 732332 merged by jenkins-bot:

[mediawiki/extensions/Wikibase@wmf/1.38.0-wmf.5] Update deprecated calls in ShortDescHandler

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

Mentioned in SAL (#wikimedia-operations) [2021-10-20T17:00:47Z] <hashar@deploy1002> Synchronized php-1.38.0-wmf.5/extensions/Wikibase/client: Update deprecated calls to ParserOutput in ShortDescHandler - T293860 (duration: 01m 03s)

There was just a few of those happening in production (once per hour or so). I have deployed the change to production. Thank you for the quick fix!

Change 732272 merged by jenkins-bot:

[mediawiki/extensions/Wikibase@master] Update deprecated calls in ShortDescHandler

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

Change 732355 merged by jenkins-bot:

[mediawiki/extensions/Wikibase@master] Rename ParserOutput and OutputPage variables to disambiguate

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