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


Seen on 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


#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}
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJun 7 2018, 7:35 PM
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 added a subscriber: Krinkle.

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

Krinkle added a comment.EditedAug 20 2018, 3:58 AM

Last 7 days:


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:


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

Thanks for the data.

It is the answer '0' in resulting in an undefined index.

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

Umherirrender closed this task as Resolved.Sep 6 2018, 4:06 PM
Umherirrender triaged this task as Normal priority.
Umherirrender claimed this task.
Restricted Application added a project: User-Ryasmeen. · View Herald TranscriptSep 6 2018, 4:06 PM