Commit 6419618f541 for php.net
commit 6419618f54157521ff65f3040f092b45aae98214
Author: Ayesh Karunaratne <ayesh@aye.sh>
Date: Sat Jan 31 20:11:40 2026 +0700
ext/standard: update `array_filter` `$mode` param default value to `ARRAY_FILTER_USE_VALUE`
In GH-15647, the `array_filter` function was changed to throw a
`ValueError` exception when the `$mode` parameter receives an
invalid.
Additionally, it declares a new `ARRAY_FILTER_USE_VALUE`, assigned
(`int 1`) to it.
This changes the default value of the `array_filter` function's
`$mode` parameter to use the new constant, changing it from
`int $mode = 0` to `int $mode = ARRAY_FILTER_USE_KEY)`.
Closes GH-21100.
diff --git a/ext/standard/basic_functions.stub.php b/ext/standard/basic_functions.stub.php
index 4ad26063a67..4f77cf9b7f8 100644
--- a/ext/standard/basic_functions.stub.php
+++ b/ext/standard/basic_functions.stub.php
@@ -1871,7 +1871,7 @@ function array_product(array $array): int|float {}
function array_reduce(array $array, callable $callback, mixed $initial = null): mixed {}
-function array_filter(array $array, ?callable $callback = null, int $mode = 0): array {}
+function array_filter(array $array, ?callable $callback = null, int $mode = ARRAY_FILTER_USE_KEY): array {}
function array_find(array $array, callable $callback): mixed {}
diff --git a/ext/standard/basic_functions_arginfo.h b/ext/standard/basic_functions_arginfo.h
index 2a1aa634fcd..d63ea5e4e48 100644
Binary files a/ext/standard/basic_functions_arginfo.h and b/ext/standard/basic_functions_arginfo.h differ