From: tjhunt Date: Mon, 16 Oct 2006 15:23:54 +0000 (+0000) Subject: Make things a bit more robust. Sorry, I can't remember exactly what the problem was... X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=879caa5172a7cc093e450dfae38cc42c33d2a975;p=moodle.git Make things a bit more robust. Sorry, I can't remember exactly what the problem was that this fixed any more. It has been sitting around for a couple of weeks and I had forgotten to commit it. --- diff --git a/question/type/questiontype.php b/question/type/questiontype.php index 1cb9e0f15e..a150f5aa53 100644 --- a/question/type/questiontype.php +++ b/question/type/questiontype.php @@ -806,7 +806,14 @@ class default_questiontype { */ function response_summary($question, $state, $length=80) { // This should almost certainly be overridden - return substr(implode(',', $this->get_actual_response($question, $state)), 0, $length); + $responses = $this->get_actual_response($question, $state); + if (empty($responses) || !is_array($responses)) { + $responses = array(); + } + if (is_array($responses)) { + $responses = implode(',', $responses); + } + return substr($responses, 0, $length); } /**