Page MenuHomePhabricator

BadMethodCallException when creating a quiz that takes zero as an answer
Closed, DuplicatePublic

Description

BadMethodCallException from line 478 of /srv/mediawiki/php-1.30.0-wmf.7/extensions/Quiz/Question.php:
 Call to a member function processTemplate() on a non-object (null)

Stack:

#0 /srv/mediawiki/php-1.30.0-wmf.7/extensions/Quiz/Question.php(344): Question->parseTextField(array)
#1 /srv/mediawiki/php-1.30.0-wmf.7/extensions/Quiz/Quiz.class.php(325): Question->textFieldParseObject(string)
#2 /srv/mediawiki/php-1.30.0-wmf.7/extensions/Quiz/Quiz.class.php(250): Quiz->parseQuestion(array, boolean)
#3 /srv/mediawiki/php-1.30.0-wmf.7/extensions/Quiz/Quiz.class.php(123): Quiz->parseQuestions(string)
#4 /srv/mediawiki/php-1.30.0-wmf.7/extensions/Quiz/Quiz.hooks.php(28): Quiz->parseQuiz(string)
#5 /srv/mediawiki/php-1.30.0-wmf.7/includes/parser/Parser.php(3882): QuizHooks::renderQuiz(string, array, Parser, PPFrame_Hash)
#6 /srv/mediawiki/php-1.30.0-wmf.7/includes/parser/Preprocessor_Hash.php(1146): Parser->extensionSubstitution(array, PPFrame_Hash)
#7 /srv/mediawiki/php-1.30.0-wmf.7/includes/parser/Parser.php(2951): PPFrame_Hash->expand(PPNode_Hash_Tree, integer)
#8 /srv/mediawiki/php-1.30.0-wmf.7/includes/parser/Parser.php(1306): Parser->replaceVariables(string)
#9 /srv/mediawiki/php-1.30.0-wmf.7/includes/parser/Parser.php(451): Parser->internalParse(string)
#10 /srv/mediawiki/php-1.30.0-wmf.7/includes/StubObject.php(113): Parser->parse(string, Title, ParserOptions, boolean, boolean, integer)
#11 /srv/mediawiki/php-1.30.0-wmf.7/includes/StubObject.php(139): StubObject->_call(string, array)
#12 /srv/mediawiki/php-1.30.0-wmf.7/includes/content/WikitextContent.php(330): StubObject->__call(string, array)
#13 /srv/mediawiki/php-1.30.0-wmf.7/includes/content/AbstractContent.php(497): WikitextContent->fillParserOutput(Title, integer, ParserOptions, boolean, ParserOutput)
#14 /srv/mediawiki/php-1.30.0-wmf.7/includes/poolcounter/PoolWorkArticleView.php(140): AbstractContent->getParserOutput(Title, integer, ParserOptions)
#15 /srv/mediawiki/php-1.30.0-wmf.7/includes/poolcounter/PoolCounterWork.php(123): PoolWorkArticleView->doWork()
#16 /srv/mediawiki/php-1.30.0-wmf.7/includes/page/Article.php(586): PoolCounterWork->execute()
#17 /srv/mediawiki/php-1.30.0-wmf.7/includes/actions/ViewAction.php(68): Article->view()
#18 /srv/mediawiki/php-1.30.0-wmf.7/includes/MediaWiki.php(499): ViewAction->show()
#19 /srv/mediawiki/php-1.30.0-wmf.7/includes/MediaWiki.php(293): MediaWiki->performAction(Article, Title)
#20 /srv/mediawiki/php-1.30.0-wmf.7/includes/MediaWiki.php(862): MediaWiki->performRequest()
#21 /srv/mediawiki/php-1.30.0-wmf.7/includes/MediaWiki.php(523): MediaWiki->main()
#22 /srv/mediawiki/php-1.30.0-wmf.7/index.php(43): MediaWiki->run()
#23 /srv/mediawiki/w/index.php(3): include(string)
#24 {main}

The following quiz code is causing the page display to return a "BadMethodCallException":

<quiz display=simple>

{Primera pregunta de prueba para validar [[phab:T166439|T166439]] - Quiz extension can't take zero as an answer even if it it correct
|type="{}"}

Este es el texto de la pregunta. Y este es el espacio para responder: { 0 }

</quiz>

It is currently present in esWV sandbox: https://es.wikiversity.org/wiki/Wikiversidad:Zona_de_pruebas

Before the code was not taking the answer but it was not generating the exception.

Details

Related Gerrit Patches:

Event Timeline

mmodell created this task.Jun 28 2017, 8:21 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJun 28 2017, 8:21 PM

I haven't actually seen this again today so I have removed it from blocking T167536: MW-1.30.0-wmf.7 deployment blockers.

Mvolz assigned this task to Harjotsingh.Jul 6 2017, 11:09 AM
Mvolz raised the priority of this task from High to Unbreak Now!.
Restricted Application added subscribers: Jay8g, TerraCodes. · View Herald TranscriptJul 6 2017, 11:09 AM
Mvolz renamed this task from BadMethodCallException from line 478 of /srv/mediawiki/php-1.30.0-wmf.7/extensions/Quiz/Question.php: Call to a member function processTemplate() on a non-object (null) to [Regression] BadMethodCallException when creating a quiz that takes zero as an answer.Jul 6 2017, 11:10 AM
Mvolz added a project: Regression.
Mvolz added subscribers: Lsanabria, Harjotsingh.
Mvolz added a subscriber: Mvolz.
Mvolz updated the task description. (Show Details)Jul 6 2017, 11:12 AM

I checked some commits before this commit and it still shows badMethodCallException.

Example commit 0977f3edb566c84188ede0dc915fe9c549a7066d still gives this exception even if it was before this patch was submitted.

Can it be due to changes in master or template parser ?

Mvolz renamed this task from [Regression] BadMethodCallException when creating a quiz that takes zero as an answer to BadMethodCallException when creating a quiz that takes zero as an answer.Jul 6 2017, 7:04 PM
Mvolz lowered the priority of this task from Unbreak Now! to High.
Mvolz removed a project: Regression.

Change 365436 had a related patch set uploaded (by Harjotsingh; owner: Harjotsingh):
[mediawiki/extensions/Quiz@master] Remove BadMethodCallException when zero is taken as answer in quiz

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

Change 365437 had a related patch set uploaded (by Harjotsingh; owner: Harjotsingh):
[mediawiki/extensions/Quiz@master] Remove BadMethodCallException when creating quiz with no answer and zero

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

Change 365436 abandoned by Harjotsingh:
Remove BadMethodCallException when zero is taken as answer in quiz

Reason:
Merged with https://gerrit.wikimedia.org/r/#/c/365437/

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

mmodell changed the subtype of this task from "Task" to "Production Error".Aug 28 2019, 11:10 PM