From 0fba5b440de6d1d3c54d5165ac5c90f642246c96 Mon Sep 17 00:00:00 2001 From: "Eloy Lafuente (stronk7)" Date: Thu, 22 Sep 2016 19:17:47 +0200 Subject: [PATCH] MDL-55327 mod_lesson: better convert back to plain response_editor --- mod/lesson/pagetypes/matching.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/mod/lesson/pagetypes/matching.php b/mod/lesson/pagetypes/matching.php index a4260f2c814..f88d04b2b7f 100644 --- a/mod/lesson/pagetypes/matching.php +++ b/mod/lesson/pagetypes/matching.php @@ -120,9 +120,10 @@ class lesson_page_type_matching extends lesson_page { // Check for duplicate response format. $duplicateresponse = array(); - if (is_array($properties->response_editor[0])) { - foreach ($properties->response_editor as $response) { - $duplicateresponse[] = $response['text']; + if (is_array($properties->response_editor) && // If there are response_editors to iterate. + is_array(reset($properties->response_editor))) { // And they come split into text & format array. + foreach ($properties->response_editor as $response) { // Iterate over all them. + $duplicateresponse[] = $response['text']; // Picking the text only. This pagetype is that way. } $properties->response_editor = $duplicateresponse; }