diff --git a/public/course/format/classes/local/cmactions.php b/public/course/format/classes/local/cmactions.php index 4458fa44384..18d45a87ce2 100644 --- a/public/course/format/classes/local/cmactions.php +++ b/public/course/format/classes/local/cmactions.php @@ -79,9 +79,10 @@ class cmactions extends baseactions { $paramcleaning = empty($CFG->formatstringstriptags) ? PARAM_CLEANHTML : PARAM_TEXT; $name = clean_param($name, $paramcleaning); - if (empty($name)) { + if ($name === '') { return false; } + if (core_text::strlen($name) > 1333) { throw new moodle_exception('maximumchars', 'moodle', '', 1333); } @@ -103,10 +104,8 @@ class cmactions extends baseactions { 'timemodified' => time(), ] ); - $cm->name = $name; - $fields = new \stdClass(); - $fields->name = $name; + $cm->name = $name; \core\event\course_module_updated::create_from_cm($cm)->trigger(); course_modinfo::purge_course_module_cache($cm->course, $cm->id);