From 38d739257df48986b839a826b1732f6c5dc94cf5 Mon Sep 17 00:00:00 2001 From: pichetp Date: Thu, 18 Sep 2008 14:48:11 +0000 Subject: [PATCH] MDL-16427 changing $answer=='*' to $answer ==='*' --- question/type/numerical/questiontype.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/question/type/numerical/questiontype.php b/question/type/numerical/questiontype.php index 2b2f5673d679a..b85cf57313b28 100644 --- a/question/type/numerical/questiontype.php +++ b/question/type/numerical/questiontype.php @@ -122,7 +122,7 @@ function save_question_options($question) { $answer = new stdClass; $answer->question = $question->id; - if (trim($dataanswer) == '*') { + if (trim($dataanswer) === '*') { $answer->answer = '*'; } else { $answer->answer = $this->apply_unit($dataanswer, $units); @@ -215,6 +215,7 @@ function save_numerical_units($question) { for ($i = 0; $i < $n; $i++) { // Discard any unit which doesn't specify the unit or the multiplier if (!empty($question->multiplier[$i]) && !empty($question->unit[$i])) { + $units[$i] = new stdClass; $units[$i]->question = $question->id; $units[$i]->multiplier = $this->apply_unit($question->multiplier[$i], array()); $units[$i]->unit = $question->unit[$i]; @@ -274,7 +275,7 @@ function compare_responses(&$question, $state, $teststate) { */ function test_response(&$question, &$state, $answer) { // Deal with the match anything answer. - if ($answer->answer == '*') { + if ($answer->answer === '*') { return true; }