Details
-
Sub-task
-
Resolution: Fixed
-
Minor
-
3.11.4, 4.1
-
MOODLE_311_STABLE, MOODLE_401_STABLE
-
MOODLE_401_STABLE
-
MDL-73433-master -
Description
One of the changes in PHP8.1 is that the functions that accept string arguments no longer accept null. For backward-compatibility we want to ensure that all functions in the core_text class do not show any debugging messages when we pass null.
Passing null to a non-nullable argument of a built-in function is
|
deprecated. This matches the behavior of user-defined functions, where null
|
is never accepted by non-nullable arguments.
|
user-defined functions.
|
|
var_dump(str_contains("foobar", null));
|
// Deprecated: Passing null to parameter #2 ($needle) of type string
|
// is deprecated
|
|
RFC: https://wiki.php.net/rfc/deprecate_null_to_scalar_internal_arg