Commit 32c1931f181 for php.net

commit 32c1931f18109655bc074dd5cda3248b838de636
Author: Tim Düsterhus <tim@tideways-gmbh.com>
Date:   Thu Apr 2 21:19:27 2026 +0200

    standard: Add `enum SortDirection` (#21501)

    RFC: https://wiki.php.net/rfc/sort_direction_enum

diff --git a/NEWS b/NEWS
index bb7df3d41c9..1759f6e2ee7 100644
--- a/NEWS
+++ b/NEWS
@@ -142,6 +142,7 @@ PHP                                                                        NEWS
   . Fixed bug GH-13204 (glob() fails if square bracket is in current directory).
     (ndossche)
   . Add array size maximum to array_diff(). (ndossche)
+  . Add enum SortDirection. (timwolla)

 - Streams:
   . Added so_keepalive, tcp_keepidle, tcp_keepintvl and tcp_keepcnt stream
diff --git a/UPGRADING b/UPGRADING
index 560e0a5eca8..467387a9ea3 100644
--- a/UPGRADING
+++ b/UPGRADING
@@ -163,6 +163,10 @@ PHP 8.6 UPGRADE NOTES
 7. New Classes and Interfaces
 ========================================

+- Standard:
+  . enum SortDirection
+    RFC: https://wiki.php.net/rfc/sort_direction_enum
+
 ========================================
 8. Removed Extensions and SAPIs
 ========================================
diff --git a/ext/reflection/tests/ReflectionExtension_getClassNames_basic.phpt b/ext/reflection/tests/ReflectionExtension_getClassNames_basic.phpt
index 47813255381..9d121070509 100644
--- a/ext/reflection/tests/ReflectionExtension_getClassNames_basic.phpt
+++ b/ext/reflection/tests/ReflectionExtension_getClassNames_basic.phpt
@@ -15,6 +15,7 @@
 AssertionError
 Directory
 RoundingMode
+SortDirection
 StreamBucket
 __PHP_Incomplete_Class
 php_user_filter
diff --git a/ext/standard/array.c b/ext/standard/array.c
index f391829c676..7aafe6ea0a1 100644
--- a/ext/standard/array.c
+++ b/ext/standard/array.c
@@ -60,6 +60,7 @@
 /* }}} */

 ZEND_DECLARE_MODULE_GLOBALS(array)
+PHPAPI zend_class_entry *sort_direction_ce;

 /* {{{ php_array_init_globals */
 static void php_array_init_globals(zend_array_globals *array_globals)
diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c
index a7417f2a390..04505db1583 100644
--- a/ext/standard/basic_functions.c
+++ b/ext/standard/basic_functions.c
@@ -297,6 +297,7 @@ PHP_MINIT_FUNCTION(basic) /* {{{ */
 	assertion_error_ce = register_class_AssertionError(zend_ce_error);

 	rounding_mode_ce = register_class_RoundingMode();
+	sort_direction_ce = register_class_SortDirection();

 	BASIC_MINIT_SUBMODULE(var)
 	BASIC_MINIT_SUBMODULE(file)
diff --git a/ext/standard/basic_functions.stub.php b/ext/standard/basic_functions.stub.php
index 6d0c565fc2d..1f3d5617f8d 100644
--- a/ext/standard/basic_functions.stub.php
+++ b/ext/standard/basic_functions.stub.php
@@ -90,6 +90,11 @@
  */
 const SORT_FLAG_CASE = UNKNOWN;

+enum SortDirection {
+    case Ascending;
+    case Descending;
+}
+
 /**
  * @var int
  * @cvalue PHP_CASE_LOWER
diff --git a/ext/standard/basic_functions_arginfo.h b/ext/standard/basic_functions_arginfo.h
index d0109fa27c9..991d76d91fc 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 139b47f2444..fce41100fc7 100644
Binary files a/ext/standard/basic_functions_decl.h and b/ext/standard/basic_functions_decl.h differ
diff --git a/ext/standard/php_array.h b/ext/standard/php_array.h
index 2205082e91d..a7eae0777d9 100644
--- a/ext/standard/php_array.h
+++ b/ext/standard/php_array.h
@@ -63,6 +63,8 @@ PHPAPI bool php_array_pick_keys(php_random_algo_with_state engine, zval *input,
 #define ARRAY_FILTER_USE_BOTH	1
 #define ARRAY_FILTER_USE_KEY	2

+extern PHPAPI zend_class_entry *sort_direction_ce;
+
 ZEND_BEGIN_MODULE_GLOBALS(array)
 	bucket_compare_func_t *multisort_func;
 	bool compare_deprecation_thrown;