Skip to content

Commit

Permalink
MDL-45763 Question types: Allow saving '0' as question text.
Browse files Browse the repository at this point in the history
  • Loading branch information
Damyon Wiese committed Jun 11, 2014
1 parent d468b94 commit 801dea3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion question/type/questiontypebase.php
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,10 @@ public function save_question($question, $form) {
$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']);
Expand Down

0 comments on commit 801dea3

Please sign in to comment.