diff --git a/classes/auth.php b/classes/auth.php index 5b0f4ce3c..a6294014d 100644 --- a/classes/auth.php +++ b/classes/auth.php @@ -642,7 +642,7 @@ public function saml_login_complete($attributes) { $accentsensitive = true; if ($this->config->tolower == saml2_settings::OPTION_TOLOWER_LOWER_CASE) { $this->log(__FUNCTION__ . " to lowercase for $uid"); - $uid = strtolower($uid); + $uid = \core_text::strtolower($uid); } if ($this->config->tolower == saml2_settings::OPTION_TOLOWER_CASE_INSENSITIVE) { $this->log(__FUNCTION__ . " case insensitive compare for $uid"); @@ -696,7 +696,7 @@ public function saml_login_complete($attributes) { $this->update_user_record_from_attribute_map($user, $attributes, true); if (empty($user->username)) { // Just in case username field not set, use uid. - $user->username = strtolower($uid); + $user->username = \core_text::strtolower($uid); } // Set the auth to saml2 if it's not set from the attributes. if (empty($user->auth)) { @@ -979,7 +979,7 @@ public function update_user_record_from_attribute_map(&$user, $attributes, $newu } } if ($field == 'username') { - $user->$field = strtolower($attributes[$attr][0]); + $user->$field = \core_text::strtolower($attributes[$attr][0]); } else { // Custom profile fields have the prefix profile_field_ and will be saved as profile field data. $delimiter = $mapconfig->fielddelimiter; @@ -1047,7 +1047,7 @@ public function get_email_from_attributes(array $attributes) { */ private function get_username_from_attributes(array $attributes) { if (!empty($this->config->field_map_username) && !empty($attributes[$this->config->field_map_username])) { - return strtolower($attributes[$this->config->field_map_username][0]); + return \core_text::strtolower($attributes[$this->config->field_map_username][0]); } return false; diff --git a/tests/behat/behat_auth_saml2.php b/tests/behat/behat_auth_saml2.php index c7536bd62..4deab49f8 100644 --- a/tests/behat/behat_auth_saml2.php +++ b/tests/behat/behat_auth_saml2.php @@ -212,7 +212,7 @@ public function the_saml_setting_is_set_to_auth_saml($setting, $value) { $setting = 'flagmessage'; } - $lowervalue = strtolower($value); + $lowervalue = core_text::strtolower($value); $value = array_key_exists($lowervalue, $map) ? $map[$lowervalue] : $value; set_config($setting, $value, 'auth_saml2'); }