From: jamiesensei Date: Fri, 19 Jan 2007 07:18:26 +0000 (+0000) Subject: fix for erroneous empty answer detection when answer is '0' which is a valid answer... X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=b7d4df606ebfd8c81f8106d6561075b150fe4a1a;p=moodle.git fix for erroneous empty answer detection when answer is '0' which is a valid answer for numeric qs. --- diff --git a/question/type/calculated/edit_calculated_form.php b/question/type/calculated/edit_calculated_form.php index 2bd209b10d..4cc3b4fa06 100644 --- a/question/type/calculated/edit_calculated_form.php +++ b/question/type/calculated/edit_calculated_form.php @@ -176,13 +176,13 @@ class question_edit_calculated_form extends question_edit_form { foreach ($answers as $key => $answer){ //check no of choices $trimmedanswer = trim($answer); - if (!empty($trimmedanswer)||$answercount==0){ + if (($trimmedanswer=='')||$answercount==0){ $eqerror = qtype_calculated_find_formula_errors($trimmedanswer); if (FALSE !== $eqerror){ $errors['answers['.$key.']'] = $eqerror; } } - if (!empty($trimmedanswer)){ + if ($trimmedanswer==''){ if ('2' == $data['correctanswerformat'][$key] && '0' == $data['correctanswerlength'][$key]) { $errors['correctanswerlength['.$key.']'] = get_string('zerosignificantfiguresnotallowed','quiz');