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.
This commit is contained in:
Sam Hemelryk
2014-07-18 08:29:53 +12:00
parent a9e0505fde
commit d3c034f8e8
+2 -1
View File
@@ -139,7 +139,8 @@ class base_setting_ui {
* @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;