From: tjhunt Date: Wed, 23 Aug 2006 19:04:24 +0000 (+0000) Subject: MDL-6338 - Short answer questions with ' in the answer don't work. Merged from MOODLE... X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=9e8dba7960f0b9681926ab8ded3b8363c52536c9;p=moodle.git MDL-6338 - Short answer questions with ' in the answer don't work. Merged from MOODLE_16_STABLE. Yet another unpleasant quiz bug caused by the current broken way we do things with addslashes. --- diff --git a/question/type/shortanswer/questiontype.php b/question/type/shortanswer/questiontype.php index b34af78e0d..a2e4e90d6c 100644 --- a/question/type/shortanswer/questiontype.php +++ b/question/type/shortanswer/questiontype.php @@ -27,9 +27,9 @@ class question_shortanswer_qtype extends default_questiontype { } if (!$question->options->answers = get_records('question_answers', 'question', - $question->id, 'id ASC')) { - notify('Error: Missing question answers!'); - return false; + $question->id, 'id ASC')) { + notify('Error: Missing question answers!'); + return false; } return true; } @@ -140,7 +140,7 @@ class question_shortanswer_qtype extends default_questiontype { /// Print input controls if (isset($state->responses[''])) { - $value = ' value="'.s($state->responses['']).'" '; + $value = ' value="'.s($state->responses[''], true).'" '; } else { $value = ' value="" '; } @@ -197,7 +197,7 @@ class question_shortanswer_qtype extends default_questiontype { } function test_response(&$question, $state, $answer) { - return $this->compare_string_with_wildcard($state->responses[''], + return $this->compare_string_with_wildcard(stripslashes_safe($state->responses['']), $answer->answer, !$question->options->usecase); }