Page MenuHomePhabricator

PHP Notice: Undefined index from extensions/Quiz/Question.php on line 380
Closed, ResolvedPublicPRODUCTION ERROR

Description

Seen on https://logstash.wikimedia.org/app/kibana#/dashboard/mediawiki-errors for "Quiz", since at least the 1.32.0-wmf.7 branch. About 50 records currently in Logstash (July 2018).

exception.message	       	PHP Notice: Undefined index: 3
exception.file	     /srv/mediawiki/php-1.32.0-wmf.14/extensions/Quiz/Question.php:380

exception.trace

#0 /srv/mediawiki/php-1.32.0-wmf.14/extensions/Quiz/Question.php(380): MWExceptionHandler::handleError(integer, string, string, integer, array, array)
#1 /srv/mediawiki/php-1.32.0-wmf.14/extensions/Quiz/Question.php(186): Question->basicTypeParseObject(string, string)
#2 /srv/mediawiki/php-1.32.0-wmf.14/extensions/Quiz/Quiz.class.php(324): Question->multipleChoiceParseObject(string)
#3 /srv/mediawiki/php-1.32.0-wmf.14/extensions/Quiz/Quiz.class.php(246): Quiz->parseQuestion(array, boolean)
#4 /srv/mediawiki/php-1.32.0-wmf.14/extensions/Quiz/Quiz.class.php(151): Quiz->parseQuestions(string)
#5 /srv/mediawiki/php-1.32.0-wmf.14/extensions/Quiz/Quiz.hooks.php(28): Quiz->parseQuiz(string)
#6 /srv/mediawiki/php-1.32.0-wmf.14/includes/parser/Parser.php(3898): QuizHooks::renderQuiz(string, array, Parser, PPFrame_Hash)
#7 /srv/mediawiki/php-1.32.0-wmf.14/includes/parser/Preprocessor_Hash.php(1188): Parser->extensionSubstitution(array, PPFrame_Hash)
#8 /srv/mediawiki/php-1.32.0-wmf.14/includes/parser/Parser.php(2953): PPFrame_Hash->expand(PPNode_Hash_Tree, integer)
#9 /srv/mediawiki/php-1.32.0-wmf.14/includes/parser/Parser.php(1297): Parser->replaceVariables(string)
#10 /srv/mediawiki/php-1.32.0-wmf.14/includes/parser/Parser.php(446): Parser->internalParse(string)
#11 /srv/mediawiki/php-1.32.0-wmf.14/includes/content/WikitextContent.php(323): Parser->parse(string, Title, ParserOptions, boolean, boolean, integer)
#12 /srv/mediawiki/php-1.32.0-wmf.14/includes/content/AbstractContent.php(516): WikitextContent->fillParserOutput(Title, integer, ParserOptions, boolean, ParserOutput)
#13 /srv/mediawiki/php-1.32.0-wmf.14/includes/poolcounter/PoolWorkArticleView.php(145): AbstractContent->getParserOutput(Title, integer, ParserOptions)
#14 /srv/mediawiki/php-1.32.0-wmf.14/includes/poolcounter/PoolCounterWork.php(123): PoolWorkArticleView->doWork()
#15 /srv/mediawiki/php-1.32.0-wmf.14/includes/page/Article.php(604): PoolCounterWork->execute()
#16 /srv/mediawiki/php-1.32.0-wmf.14/includes/actions/ViewAction.php(68): Article->view()
#17 /srv/mediawiki/php-1.32.0-wmf.14/includes/MediaWiki.php(500): ViewAction->show()
#18 /srv/mediawiki/php-1.32.0-wmf.14/includes/MediaWiki.php(294): MediaWiki->performAction(Article, Title)
#19 /srv/mediawiki/php-1.32.0-wmf.14/includes/MediaWiki.php(867): MediaWiki->performRequest()
#20 /srv/mediawiki/php-1.32.0-wmf.14/includes/MediaWiki.php(524): MediaWiki->main()
#21 /srv/mediawiki/php-1.32.0-wmf.14/index.php(42): MediaWiki->run()
#22 /srv/mediawiki/w/index.php(3): include(string)
#23 {main}

Event Timeline

Vvjjkkii renamed this task from Notice: Undefined index: 0 in /srv/mediawiki/php-1.32.0-wmf.7/extensions/Quiz/Question.php on line 380 to vfbaaaaaaa.Jul 1 2018, 1:05 AM
Vvjjkkii triaged this task as High priority.
Vvjjkkii updated the task description. (Show Details)
Vvjjkkii removed a subscriber: Aklapper.
Mvolz renamed this task from vfbaaaaaaa to Notice: Undefined index: 0 in /srv/mediawiki/php-1.32.0-wmf.7/extensions/Quiz/Question.php on line 380.Jul 1 2018, 9:18 AM
Mvolz raised the priority of this task from High to Needs Triage.
Mvolz updated the task description. (Show Details)
Krinkle renamed this task from Notice: Undefined index: 0 in /srv/mediawiki/php-1.32.0-wmf.7/extensions/Quiz/Question.php on line 380 to PHP Notice: Undefined index from extensions/Quiz/Question.php on line 380.EditedJul 31 2018, 6:53 PM
Krinkle added a project: Editing-team.
Krinkle updated the task description. (Show Details)
Krinkle subscribed.

Still seen in production, about 50 records in Logstash July 2018.

Source of extensions/Quiz/Question.php:380

		for ( $i = 0; $i <= $proposalIndex; ++$i ) {
			$output .= $lines[ $tempOrder[ $i ] ];
		}

Moving to Backlog as I am unable to confirm whether or not this part of the extension is actually working well.

In any event, errors such as these make it harder to detect and prevent new errors in other parts of MediaWiki.

It is possible to extract a project and a wiki page from the request data for this log? Thanks.

Without a wikipage with the problematic <quiz> it could get very hard to find the mismatch between both arrays used in line 380

Last 7 days:

DomainCount
en.wikiversity.org33
it.wikibooks.org8
it.wikiversity.org8
zh.wikipedia.org6
.....

It mostly happens during saving, which is all POST /w/index.php?action=submit, or POST /w/api.php, where no title information is known.

However, a few happened during page views where the cache is outdated, here are a two examples:

  • it.wikiversity.org/wiki/Romanticismo_(scuola_media)
  • en.wikiversity.org/wiki/Ecliptic/Quizzes/Quiz_1

Change 453989 had a related patch set uploaded (by Umherirrender; owner: Umherirrender):
[mediawiki/extensions/Quiz@master] Allow a question with answer '0'

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

Change 453989 merged by jenkins-bot:
[mediawiki/extensions/Quiz@master] Allow a question with answer '0'

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

Umherirrender claimed this task.
Umherirrender triaged this task as Medium priority.
mmodell changed the subtype of this task from "Task" to "Production Error".Aug 28 2019, 11:09 PM