diff --git a/backup/backup.php b/backup/backup.php index 53e037e36f3..3c883438d96 100644 --- a/backup/backup.php +++ b/backup/backup.php @@ -62,7 +62,7 @@ switch ($type) { case backup::TYPE_1SECTION : $coursecontext = get_context_instance(CONTEXT_COURSE, $course->id); require_capability('moodle/backup:backupsection', $coursecontext); - if (!empty($section->name)) { + if ((string)$section->name !== '') { $sectionname = format_string($section->name, true, array('context' => $coursecontext)); $heading = get_string('backupsection', 'backup', $sectionname); $PAGE->navbar->add($sectionname); diff --git a/backup/moodle2/restore_stepslib.php b/backup/moodle2/restore_stepslib.php index f35b4c16b99..4f840c4a11c 100644 --- a/backup/moodle2/restore_stepslib.php +++ b/backup/moodle2/restore_stepslib.php @@ -1027,7 +1027,7 @@ class restore_section_structure_step extends restore_structure_step { // Section exists, update non-empty information } else { $section->id = $secrec->id; - if (empty($secrec->name)) { + if ((string)$secrec->name === '') { $section->name = $data->name; } if (empty($secrec->summary)) { diff --git a/backup/util/factories/backup_factory.class.php b/backup/util/factories/backup_factory.class.php index a24905c51c8..e58650d87a1 100644 --- a/backup/util/factories/backup_factory.class.php +++ b/backup/util/factories/backup_factory.class.php @@ -139,7 +139,7 @@ abstract class backup_factory { throw new backup_task_exception('section_task_section_not_found', $sectionid); } - return new backup_section_task(empty($section->name) ? $section->section : $section->name, $sectionid); + return new backup_section_task((string)$section->name !== '' ? $section->section : $section->name, $sectionid); } /** diff --git a/backup/util/ui/backup_ui_setting.class.php b/backup/util/ui/backup_ui_setting.class.php index 3db20a109e0..c18d46338cf 100644 --- a/backup/util/ui/backup_ui_setting.class.php +++ b/backup/util/ui/backup_ui_setting.class.php @@ -129,7 +129,7 @@ class base_setting_ui { * @param string $label */ public function set_label($label) { - if (empty($label) || $label !== clean_param($label, PARAM_TEXT)) { + if ((string)$label === '' || $label !== clean_param($label, PARAM_TEXT)) { throw new base_setting_ui_exception('setting_invalid_ui_label'); } $this->label = $label;