diff --git a/UPGRADING b/UPGRADING index fec4b15c102b..830709b2ae23 100644 --- a/UPGRADING +++ b/UPGRADING @@ -142,6 +142,9 @@ PHP 8.6 UPGRADE NOTES . EAI_INTR. . EAI_IDN_ENCODE. +- Standard + . ARRAY_FILTER_USE_KEY. + ======================================== 11. Changes to INI File Handling ======================================== diff --git a/Zend/tests/gh20628_005.phpt b/Zend/tests/gh20628_005.phpt new file mode 100644 index 000000000000..43b49e0c18f2 --- /dev/null +++ b/Zend/tests/gh20628_005.phpt @@ -0,0 +1,20 @@ +--TEST-- +Failed assertion for assignment in expression context +--CREDITS-- +Matteo Beccati (mbeccati) +--FILE-- + 'baz']; +} + +var_dump(($v = foo())['bar'], $v); + +?> +--EXPECT-- +string(3) "baz" +array(1) { + ["bar"]=> + string(3) "baz" +} diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 325953e158e8..a013efab8596 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -12303,7 +12303,6 @@ static zend_op *zend_compile_var_inner(znode *result, zend_ast *ast, uint32_t ty zend_compile_assign_ref(result, ast, type); return NULL; case ZEND_AST_ASSIGN: - ZEND_ASSERT(ast->child[0]->kind == ZEND_AST_ARRAY && zend_propagate_list_refs(ast->child[0])); zend_compile_assign(result, ast, false, type); return NULL; default: diff --git a/ext/standard/basic_functions.stub.php b/ext/standard/basic_functions.stub.php index 4ad26063a671..4f77cf9b7f8e 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 2a1aa634fcda..d63ea5e4e488 100644 --- a/ext/standard/basic_functions_arginfo.h +++ b/ext/standard/basic_functions_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit basic_functions.stub.php instead. - * Stub hash: a4324854949e2df355625c18a4e26d066c8f7a17 */ + * Stub hash: 9857f77dbcc832992bf6b20b02d4b81dad8909b2 */ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_set_time_limit, 0, 1, _IS_BOOL, 0) ZEND_ARG_TYPE_INFO(0, seconds, IS_LONG, 0) @@ -345,7 +345,7 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_array_filter, 0, 1, IS_ARRAY, 0) ZEND_ARG_TYPE_INFO(0, array, IS_ARRAY, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, callback, IS_CALLABLE, 1, "null") - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, mode, IS_LONG, 0, "0") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, mode, IS_LONG, 0, "ARRAY_FILTER_USE_KEY") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_array_find, 0, 2, IS_MIXED, 0)