From 708160cb4a38c205fa7bbca13d8a8da7580b5e5e Mon Sep 17 00:00:00 2001 From: Paul Holden Date: Wed, 26 Nov 2025 17:12:58 +0000 Subject: [PATCH] MDL-87321 courseformat: explicit empty string check renaming module. --- course/format/classes/local/cmactions.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/course/format/classes/local/cmactions.php b/course/format/classes/local/cmactions.php index fe300b1008c..e6a35c0c17e 100644 --- a/course/format/classes/local/cmactions.php +++ b/course/format/classes/local/cmactions.php @@ -76,9 +76,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) > 255) { throw new \moodle_exception('maximumchars', 'moodle', '', 255); } @@ -100,10 +101,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);