diff --git a/NEWS b/NEWS index 7124d1bc278a..da5c90ec8edf 100644 --- a/NEWS +++ b/NEWS @@ -36,6 +36,9 @@ PHP NEWS - Standard: . Fixed bug GH-19926 (reset internal pointer earlier while splicing array while COW violation flag is still set). (alexandre-daubois) + . strcoll() now throws a ValueError when passed a string containing NUL bytes + instead of silently cutting off the string after the first NUL byte. + (ndossche) - Streams: . Added so_reuseaddr streams context socket option that allows disabling diff --git a/UPGRADING b/UPGRADING index 3b0301522d46..3ad5d95a3a86 100644 --- a/UPGRADING +++ b/UPGRADING @@ -23,6 +23,10 @@ PHP 8.6 UPGRADE NOTES . Invalid values now throw in Phar::mungServer() instead of being silently ignored. +- Standard: + . strcoll() now throws a ValueError when passed a string containing NUL bytes + instead of silently cutting off the string after the first NUL byte. + ======================================== 2. New Features ======================================== diff --git a/ext/standard/string.c b/ext/standard/string.c index 029c7a29bb47..de36270d1c46 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -458,8 +458,8 @@ PHP_FUNCTION(strcoll) zend_string *s1, *s2; ZEND_PARSE_PARAMETERS_START(2, 2) - Z_PARAM_STR(s1) - Z_PARAM_STR(s2) + Z_PARAM_PATH_STR(s1) + Z_PARAM_PATH_STR(s2) ZEND_PARSE_PARAMETERS_END(); RETURN_LONG(strcoll((const char *) ZSTR_VAL(s1),