From 879caa5172a7cc093e450dfae38cc42c33d2a975 Mon Sep 17 00:00:00 2001 From: tjhunt Date: Mon, 16 Oct 2006 15:23:54 +0000 Subject: [PATCH] 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. --- question/type/questiontype.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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); } /** -- 2.39.5