Page MenuHomePhabricator

PHP warning - deprecated fallback handling for comment rc_comment
Open, Needs TriagePublic

Description

Version: 1.30
PHP: 5.6

After the upgrade to 1.30, I've started to see this error in the php error log.

[16-Dec-2017 06:19:09 UTC] PHP Warning:  Using deprecated fallback handling for comment rc_comment [Called from CommentStore::getCommentInternal in /srv/mediawiki/w/includes/CommentStore.php at line 226] in /srv/mediawiki/w/includes/debug/MWDebug.php on line 309
2017-12-16 06:19:09 mw1 cpiwiki: [77acb3e05b58559a4509bdde] /wiki/Main_Page   ErrorException from line 309 of /srv/mediawiki/w/includes/debug/MWDebug.php: PHP Warning: Using deprecated fallback handling for comment rc_comment [Called from CommentStore::getCommentInternal in /srv/mediawiki/w/includes/CommentStore.php at line 226]
#0 [internal function]: MWExceptionHandler::handleError(integer, string, string, integer, array)
#1 /srv/mediawiki/w/includes/debug/MWDebug.php(309): trigger_error(string, integer)
#2 /srv/mediawiki/w/includes/debug/MWDebug.php(164): MWDebug::sendMessage(string, array, string, integer)
#3 /srv/mediawiki/w/includes/GlobalFunctions.php(1205): MWDebug::warning(string, integer, integer, string)
#4 /srv/mediawiki/w/includes/CommentStore.php(226): wfLogWarning(string)
#5 /srv/mediawiki/w/includes/CommentStore.php(360): CommentStore->getCommentInternal(Wikimedia\Rdbms\DatabaseMysqli, stdClass, boolean)
#6 /srv/mediawiki/w/includes/changes/RecentChange.php(955): CommentStore->getCommentLegacy(Wikimedia\Rdbms\DatabaseMysqli, stdClass, boolean)
#7 /srv/mediawiki/w/includes/changes/RecentChange.php(121): RecentChange->loadFromRow(stdClass)
#8 /srv/mediawiki/w/extensions/News/NewsRenderer.php(474): RecentChange::newFromRow(stdClass)
#9 /srv/mediawiki/w/extensions/News/NewsRenderer.php(323): NewsRenderer->renderRow(stdClass)
#10 /srv/mediawiki/w/extensions/News/News.php(55): NewsRenderer->renderNews()
#11 [internal function]: wfNewsTag(string, array, Parser, PPTemplateFrame_DOM)
#12 /srv/mediawiki/w/includes/parser/Parser.php(3852): call_user_func_array(string, array)
#13 /srv/mediawiki/w/includes/parser/Preprocessor_DOM.php(1314): Parser->extensionSubstitution(array, PPTemplateFrame_DOM)
#14 /srv/mediawiki/w/includes/parser/Preprocessor_DOM.php(1680): PPFrame_DOM->expand(PPNode_DOM, integer)
#15 /srv/mediawiki/w/includes/parser/Parser.php(3259): PPTemplateFrame_DOM->cachedExpand(string, PPNode_DOM)
#16 /srv/mediawiki/w/includes/parser/Preprocessor_DOM.php(1229): Parser->braceSubstitution(array, PPFrame_DOM)
#17 /srv/mediawiki/w/includes/parser/Parser.php(2921): PPFrame_DOM->expand(PPNode_DOM, integer)
#18 /srv/mediawiki/w/includes/parser/Parser.php(1277): Parser->replaceVariables(string)
#19 /srv/mediawiki/w/includes/parser/Parser.php(451): Parser->internalParse(string)
#20 /srv/mediawiki/w/includes/content/WikitextContent.php(329): Parser->parse(string, Title, ParserOptions, boolean, boolean, integer)
#21 /srv/mediawiki/w/includes/content/AbstractContent.php(516): WikitextContent->fillParserOutput(Title, integer, ParserOptions, boolean, ParserOutput)
#22 /srv/mediawiki/w/includes/poolcounter/PoolWorkArticleView.php(145): AbstractContent->getParserOutput(Title, integer, ParserOptions)
#23 /srv/mediawiki/w/includes/poolcounter/PoolCounterWork.php(123): PoolWorkArticleView->doWork()
#24 /srv/mediawiki/w/includes/page/Article.php(585): PoolCounterWork->execute()
#25 /srv/mediawiki/w/includes/actions/ViewAction.php(68): Article->view()
#26 /srv/mediawiki/w/includes/MediaWiki.php(499): ViewAction->show()
#27 /srv/mediawiki/w/includes/MediaWiki.php(293): MediaWiki->performAction(Article, Title)
#28 /srv/mediawiki/w/includes/MediaWiki.php(851): MediaWiki->performRequest()
#29 /srv/mediawiki/w/includes/MediaWiki.php(523): MediaWiki->main()
#30 /srv/mediawiki/w/index.php(43): MediaWiki->run()
#31 {main}

Event Timeline

Reception123 updated the task description. (Show Details)
Legoktm added subscribers: Anomie, Legoktm.

The stack trace indicates that this is an issue with the News extension not being updated for the CommentStore changes that landed in 1.30. @Anomie is there documentation/guidance for extension developers on how to update their extensions?

Looking at an example like https://gerrit.wikimedia.org/r/#/c/374864/ might be useful.

Aklapper raised the priority of this task from High to Needs Triage.Dec 17 2017, 10:31 AM

Reception123 triaged this task as High priority.

@Reception123: Do you plan to work on this yourself, or why did you set Priority? If so, please set yourself as assignee. Thanks!

@Aklapper Sorry, wasn't aware of that rule. I was initially under the impression that it was an issue with core, and thought it would deserve high priority.

Next time I will make sure to ping someone and make a suggestion rather than changing it myself.

@Anomie is there documentation/guidance for extension developers on how to update their extensions?

I don't think there's anything written down.

Generally, prefer methods such as RecentChange::getQueryInfo() when building your query to fetch rows to pass to methods such as RecentChange::newFromRow(). I note that the patch adding that method didn't make it into 1.30 though. Failing that, you can use CommentStore directly as shown in the patch you linked.

You'll also need to use CommentStore to handle situations where you're directly accessing fields such as rc_comment in a result row. Failing to do so will eventually result in your getting back an empty string, and even later will be accessing an undefined property.

Using getQueryInfo() methods will also safeguard you against similar breakage when the actor table change rolls around (see T167246). In that case, it will also provide aliased fields so you don't have to worry about directly accessing rc_user in a result row.