MDL-36076 qtype multichoice: validation fails on '0' answer.
[moodle.git] / question / type / multichoice / edit_multichoice_form.php
index e94c202..031605e 100644 (file)
@@ -110,10 +110,10 @@ class qtype_multichoice_edit_form extends question_edit_form {
             //check no of choices
             $trimmedanswer = trim($answer['text']);
             $fraction = (float) $data['fraction'][$key];
-            if (empty($trimmedanswer) && empty($fraction)) {
+            if ($trimmedanswer === '' && empty($fraction)) {
                 continue;
             }
-            if (empty($trimmedanswer)) {
+            if ($trimmedanswer === '') {
                 $errors['fraction['.$key.']'] = get_string('errgradesetanswerblank', 'qtype_multichoice');
             }