Page MenuHomePhabricator

PHP Notice: Undefined index: parse
Closed, ResolvedPublicPRODUCTION ERROR

Description

Error
normalized_message
[{reqId}] {exception_url}   PHP Notice: Undefined index: parse
exception.trace
from /srv/mediawiki/php-1.40.0-wmf.21/extensions/GlobalUserPage/includes/GlobalUserPage.php(396)
#0 /srv/mediawiki/php-1.40.0-wmf.21/extensions/GlobalUserPage/includes/GlobalUserPage.php(396): MWExceptionHandler::handleError(integer, string, string, integer, array)
#1 /srv/mediawiki/php-1.40.0-wmf.21/extensions/GlobalUserPage/includes/GlobalUserPage.php(318): MediaWiki\GlobalUserPage\GlobalUserPage->parseWikiText(Title, string, string)
#2 /srv/mediawiki/php-1.40.0-wmf.21/includes/libs/objectcache/wancache/WANObjectCache.php(1759): MediaWiki\GlobalUserPage\GlobalUserPage->MediaWiki\GlobalUserPage\{closure}(boolean, integer, array, NULL, array)
#3 /srv/mediawiki/php-1.40.0-wmf.21/includes/libs/objectcache/wancache/WANObjectCache.php(1589): WANObjectCache->fetchOrRegenerate(string, integer, Closure, array, array)
#4 /srv/mediawiki/php-1.40.0-wmf.21/extensions/GlobalUserPage/includes/GlobalUserPage.php(326): WANObjectCache->getWithSetCallback(string, integer, Closure, array)
#5 /srv/mediawiki/php-1.40.0-wmf.21/extensions/GlobalUserPage/includes/GlobalUserPage.php(83): MediaWiki\GlobalUserPage\GlobalUserPage->getRemoteParsedText(string)
#6 /srv/mediawiki/php-1.40.0-wmf.21/includes/page/Article.php(622): MediaWiki\GlobalUserPage\GlobalUserPage->showMissingArticle()
#7 /srv/mediawiki/php-1.40.0-wmf.21/includes/page/Article.php(541): Article->generateContentOutput(User, ParserOptions, integer, OutputPage, array)
#8 /srv/mediawiki/php-1.40.0-wmf.21/includes/actions/ViewAction.php(78): Article->view()
#9 /srv/mediawiki/php-1.40.0-wmf.21/includes/MediaWiki.php(551): ViewAction->show()
#10 /srv/mediawiki/php-1.40.0-wmf.21/includes/MediaWiki.php(328): MediaWiki->performAction(MediaWiki\GlobalUserPage\GlobalUserPage, Title)
#11 /srv/mediawiki/php-1.40.0-wmf.21/includes/MediaWiki.php(915): MediaWiki->performRequest()
#12 /srv/mediawiki/php-1.40.0-wmf.21/includes/MediaWiki.php(571): MediaWiki->main()
#13 /srv/mediawiki/php-1.40.0-wmf.21/index.php(50): MediaWiki->run()
#14 /srv/mediawiki/php-1.40.0-wmf.21/index.php(46): wfIndexMain()
#15 /srv/mediawiki/w/index.php(3): require(string)
#16 {main}
Impact
Notes

Details

MediaWiki Version
1.40.0-wmf.21
Request URL
https://api.wikimedia.org/wiki/User:APaskulin_(WMF)

Event Timeline

thcipriani subscribed.

Tagging with API-portal as it seems almost all of these over the past 7 days (roughly 10 per day) have happened on api.wikimedia.org

apaskulin added a project: API Platform.
apaskulin subscribed.

It looks like the API Portal isn't pulling in global user pages like it used to. For example, https://api.wikimedia.org/wiki/User:APaskulin_(WMF) should reflect content from https://meta.wikimedia.org/wiki/User:APaskulin_(WMF). Although I'm not 100% sure that this is what's causing the error. Triaging this as a low priority since the API Portal hasn't been officially announced, and tagging the API Platform team.

Wild guess: the code in question is calling the "parse" action API to get the HTML of the user page. The response is expected to contain the "parse" key. But something goes wrong, so it receives an error instead. Since it doesn't check before trying to access the field, it fails with "undefined index", instead of reporting the original error.

Wild guess: the code in question is calling the "parse" action API to get the HTML of the user page. The response is expected to contain the "parse" key. But something goes wrong, so it receives an error instead. Since it doesn't check before trying to access the field, it fails with "undefined index", instead of reporting the original error.

Yup: https://gerrit.wikimedia.org/r/plugins/gitiles/mediawiki/extensions/GlobalUserPage/+/refs/heads/master/includes/GlobalUserPage.php#396

We could just ?: false or we could properly handle?

I suppose we want to identify and fix the original error :=

Friendly ping! I'm on train duty this week which means I watch error logs. This one draws my attention from time to time.

Change 906734 had a related patch set uploaded (by Jforrester; author: Jforrester):

[mediawiki/extensions/GlobalUserPage@master] Don't read 'parse' key blindly, it might not be set

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

Change 906734 merged by jenkins-bot:

[mediawiki/extensions/GlobalUserPage@master] Don't read 'parse' key blindly, it might not be set

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