From d375d718acf6da7d22359c448dda572d803e309c Mon Sep 17 00:00:00 2001 From: Tim Hunt Date: Tue, 12 Jun 2012 17:45:40 +0100 Subject: [PATCH] MDL-33681 course: cannot have a section called '0'. No reason to prevent this. It is just a matter of doing a proper test, rather than the sloppy PHP !empty(). --- course/format/topics/lib.php | 2 +- course/format/weeks/lib.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/course/format/topics/lib.php b/course/format/topics/lib.php index b41864f8a7f..bcda79277e2 100644 --- a/course/format/topics/lib.php +++ b/course/format/topics/lib.php @@ -69,7 +69,7 @@ function callback_topics_request_key() { function callback_topics_get_section_name($course, $section) { // We can't add a node without any text - if (!empty($section->name)) { + if ((string)$section->name !== '') { return format_string($section->name, true, array('context' => get_context_instance(CONTEXT_COURSE, $course->id))); } else if ($section->section == 0) { return get_string('section0name', 'format_topics'); diff --git a/course/format/weeks/lib.php b/course/format/weeks/lib.php index 973ed4e3fc7..1dca0bad555 100644 --- a/course/format/weeks/lib.php +++ b/course/format/weeks/lib.php @@ -76,7 +76,7 @@ function callback_weeks_request_key() { */ function callback_weeks_get_section_name($course, $section) { // We can't add a node without text - if (!empty($section->name)) { + if ((string)$section->name !== '') { // Return the name the user set return format_string($section->name, true, array('context' => get_context_instance(CONTEXT_COURSE, $course->id))); } else if ($section->section == 0) {