diff --git a/lib/classes/string_manager_standard.php b/lib/classes/string_manager_standard.php index dbcfdcf131e..6d4f8595de7 100644 --- a/lib/classes/string_manager_standard.php +++ b/lib/classes/string_manager_standard.php @@ -363,7 +363,7 @@ class core_string_manager_standard implements core_string_manager { if ($a !== null) { // Process array's and objects (except lang_strings). - if (is_array($a) or (is_object($a) && !($a instanceof lang_string))) { + if (is_array($a) or (is_object($a) && !($a instanceof Stringable))) { $a = (array)$a; $search = array(); $replace = array(); @@ -372,7 +372,7 @@ class core_string_manager_standard implements core_string_manager { // We do not support numeric keys - sorry! continue; } - if (is_array($value) or (is_object($value) && !($value instanceof lang_string))) { + if (is_array($value) or (is_object($value) && !($value instanceof Stringable))) { // We support just string or lang_string as value. continue; } diff --git a/lib/classes/task/send_login_notifications.php b/lib/classes/task/send_login_notifications.php index 245a518fb5a..e32cf28d06a 100644 --- a/lib/classes/task/send_login_notifications.php +++ b/lib/classes/task/send_login_notifications.php @@ -61,7 +61,7 @@ class send_login_notifications extends adhoc_task { $userauth = get_auth_plugin($USER->auth); if ($userauth->can_change_password()) { if ($changepwurl = $userauth->change_password_url()) { - $changepasswordlink = (string) $changepwurl; + $changepasswordlink = $changepwurl; } else { $changepasswordlink = (new \moodle_url('/login/change_password.php'))->out(false); } diff --git a/lib/upgrade.txt b/lib/upgrade.txt index 24275360fc3..739edb2fc5b 100644 --- a/lib/upgrade.txt +++ b/lib/upgrade.txt @@ -5,6 +5,8 @@ information provided here is intended especially for developers. * Admin settings for passwords (admin_setting_configpasswordunmask) can now be a required field using the following class: - admin_setting_requiredpasswordunmask +* The `$a` argument passed to `get_string` can now include any stringable type, removing the need for explicit casts (for + example, of `\moodle_url` instances) * The badges_get_oauth2_service_options() method has been deprecated, because it's not required anymore. It should no longer be used. * Support for the following phpunit coverage info properties, deprecated since 3.11, has been removed: