From 4a77758f389061a039561ef0a04c7643b7e9ab06 Mon Sep 17 00:00:00 2001 From: Sam Hemelryk Date: Thu, 17 Jul 2014 12:52:18 +1200 Subject: [PATCH] MDL-46335 backup: fixed casting issue with setting labels The issue was that clean_param took an int and returned a string and the result was used in an exact comparison. The type change mean the comparison failed. The solution was to ensure the param was cast as a string. --- backup/util/ui/backup_ui_setting.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/backup/util/ui/backup_ui_setting.class.php b/backup/util/ui/backup_ui_setting.class.php index 9ef58656a2488..1712a7359a898 100644 --- a/backup/util/ui/backup_ui_setting.class.php +++ b/backup/util/ui/backup_ui_setting.class.php @@ -139,7 +139,8 @@ public function get_param_validation() { * @param string $label */ public function set_label($label) { - if ((string)$label === '' || $label !== clean_param($label, PARAM_TEXT)) { + $label = (string)$label; + if ($label === '' || $label !== clean_param($label, PARAM_TEXT)) { throw new base_setting_ui_exception('setting_invalid_ui_label'); } $this->label = $label;