Commit 22217b3bbb5 for php.net
commit 22217b3bbb5e4c1cafbb77ca7e3cbbf9861d937f
Author: Gina Peter Banyard <girgias@php.net>
Date: Wed Aug 5 17:35:23 2026 +0100
standard: deprecate strcoll and SORT_LOCALE_STRING
RFCs:
- https://wiki.php.net/rfc/deprecations_php_8_6#deprecate_strcoll
- https://wiki.php.net/rfc/deprecations_php_8_6#deprecate_sort_locale_string_flag_for_sort_functions
diff --git a/ext/standard/basic_functions.stub.php b/ext/standard/basic_functions.stub.php
index ae3c9065cb1..fb7c5b90fdb 100644
--- a/ext/standard/basic_functions.stub.php
+++ b/ext/standard/basic_functions.stub.php
@@ -78,6 +78,7 @@
* @var int
* @cvalue PHP_SORT_LOCALE_STRING
*/
+#[\Deprecated(message: "use one of the Collator::*sort*() methods instead", since: "8.6")]
const SORT_LOCALE_STRING = UNKNOWN;
/**
* @var int
@@ -2319,6 +2320,7 @@ function strcspn(string $string, string $characters, int $offset = 0, ?int $leng
function nl_langinfo(int $item): string|false {}
#endif
+#[\Deprecated(message: "use Collator::compare() instead", since: "8.6")]
function strcoll(string $string1, string $string2): int {}
/**
diff --git a/ext/standard/basic_functions_arginfo.h b/ext/standard/basic_functions_arginfo.h
index 91e1cb53276..c352ef20a40 100644
Binary files a/ext/standard/basic_functions_arginfo.h and b/ext/standard/basic_functions_arginfo.h differ
diff --git a/ext/standard/basic_functions_decl.h b/ext/standard/basic_functions_decl.h
index ac1e9843da2..159d30b2c00 100644
Binary files a/ext/standard/basic_functions_decl.h and b/ext/standard/basic_functions_decl.h differ
diff --git a/ext/standard/tests/array/sort/locale_sort.phpt b/ext/standard/tests/array/sort/locale_sort.phpt
index 2caccce78eb..abbe9e5c068 100644
--- a/ext/standard/tests/array/sort/locale_sort.phpt
+++ b/ext/standard/tests/array/sort/locale_sort.phpt
@@ -29,7 +29,8 @@
asort($table, SORT_LOCALE_STRING);
var_dump($table);
?>
---EXPECT--
+--EXPECTF--
+Deprecated: Constant SORT_LOCALE_STRING is deprecated since 8.6, use one of the Collator::*sort*() methods instead in %s on line %d
array(13) {
["AB"]=>
string(7) "Alberta"
diff --git a/ext/standard/tests/strings/strcoll.phpt b/ext/standard/tests/strings/strcoll.phpt
index d1d3df11fc1..2d36c0e82d8 100644
--- a/ext/standard/tests/strings/strcoll.phpt
+++ b/ext/standard/tests/strings/strcoll.phpt
@@ -16,5 +16,6 @@
echo "Pass\n";
}
?>
---EXPECT--
+--EXPECTF--
+Deprecated: Function strcoll() is deprecated since 8.6, use Collator::compare() instead in %s on line %d
Pass