MDL-45763 Question types: Allow saving '0' as question text.

This commit is contained in:
Damyon Wiese
2014-06-11 17:29:26 +08:00
parent d468b949f1
commit 801dea3298
+4 -1
View File
@@ -339,7 +339,10 @@ class question_type {
$question->length = $this->actual_number_of_questions($question);
$question->penalty = isset($form->penalty) ? $form->penalty : 0;
if (empty($form->questiontext['text'])) {
// The trim call below has the effect of casting any strange values received,
// like null or false, to an appropriate string, so we only need to test for
// missing values. Be careful not to break the value '0' here.
if (!isset($form->questiontext['text'])) {
$question->questiontext = '';
} else {
$question->questiontext = trim($form->questiontext['text']);