From dfcaa2450c9357d172b10955f2ce84947528712b Mon Sep 17 00:00:00 2001 From: Tim Hunt Date: Thu, 20 Feb 2014 11:44:28 +0000 Subject: [PATCH] MDL-44288 qtype_calculatedsimple fix validation notice. The notice happend if you clicked Save changes before Find the wild cards {x..} present in the correct answer formulas. --- .../type/calculatedsimple/edit_calculatedsimple_form.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/question/type/calculatedsimple/edit_calculatedsimple_form.php b/question/type/calculatedsimple/edit_calculatedsimple_form.php index 298547d15dc..eb3b13a47b0 100644 --- a/question/type/calculatedsimple/edit_calculatedsimple_form.php +++ b/question/type/calculatedsimple/edit_calculatedsimple_form.php @@ -585,7 +585,12 @@ class qtype_calculatedsimple_edit_form extends qtype_calculated_edit_form { public function validation($data, $files) { $errors = parent::validation($data, $files); - $numbers = $data['number']; + + if (array_key_exists('number', $data)) { + $numbers = $data['number']; + } else { + $numbers = array(); + } foreach ($numbers as $key => $number) { if (! is_numeric($number)) { if (stristr($number, ',')) {