]> git.mjollnir.org Git - moodle.git/commitdiff
Make things a bit more robust. Sorry, I can't remember exactly what the problem was...
authortjhunt <tjhunt>
Mon, 16 Oct 2006 15:23:54 +0000 (15:23 +0000)
committertjhunt <tjhunt>
Mon, 16 Oct 2006 15:23:54 +0000 (15:23 +0000)
question/type/questiontype.php

index 1cb9e0f15e18a80b25a3fcb05075f427cb74c50c..a150f5aa530b341384682ccc75321d531d19883c 100644 (file)
@@ -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);
     }
 
     /**