From 5391d707e20ee477188f3c4a05505680c61b0ba0 Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Mon, 26 Jul 2021 15:58:29 +0200 Subject: [PATCH 01/28] Convert iterable into an internal alias for Traversable|array --- Zend/Optimizer/zend_inference.c | 3 -- .../invalid_types/invalid_iterable_type.phpt | 2 +- .../intersection_types/variance/invalid5.phpt | 2 +- .../tests/type_declarations/iterable_001.phpt | 2 +- .../tests/type_declarations/iterable_002.phpt | 2 +- .../tests/type_declarations/iterable_003.phpt | 2 +- .../tests/type_declarations/iterable_004.phpt | 2 +- .../tests/type_declarations/iterable_005.phpt | 2 +- .../iterable_and_Traversable.phpt | 2 +- .../iterable_and_Traversable_2.phpt | 2 +- .../redundant_types/iterable_and_array.phpt | 2 +- Zend/tests/typehints/or_null.phpt | 6 +-- Zend/zend_compile.c | 47 ++++++------------- Zend/zend_execute.c | 11 +---- Zend/zend_inheritance.c | 45 ++---------------- Zend/zend_string.h | 1 + Zend/zend_type_info.h | 1 - ext/opcache/jit/zend_jit_arm64.dasc | 2 +- ext/opcache/jit/zend_jit_helpers.c | 4 +- ext/opcache/jit/zend_jit_x86.dasc | 2 +- .../tests/iterable_type_optimization.phpt | 2 +- ext/reflection/php_reflection.c | 3 -- .../tests/ReflectionClass_isArray.phpt | 2 +- ext/reflection/tests/ReflectionType_001.phpt | 11 +++-- .../tests/ReflectionType_possible_types.phpt | 6 ++- ext/reflection/tests/bug72661.phpt | 2 +- ext/reflection/tests/union_types.phpt | 9 ++-- 27 files changed, 58 insertions(+), 119 deletions(-) diff --git a/Zend/Optimizer/zend_inference.c b/Zend/Optimizer/zend_inference.c index 95c3516b408a7..c17c73ad0efcd 100644 --- a/Zend/Optimizer/zend_inference.c +++ b/Zend/Optimizer/zend_inference.c @@ -2114,9 +2114,6 @@ static uint32_t zend_convert_type_declaration_mask(uint32_t type_mask) { if (type_mask & MAY_BE_CALLABLE) { result_mask |= MAY_BE_STRING|MAY_BE_OBJECT|MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_ANY|MAY_BE_ARRAY_OF_ANY|MAY_BE_ARRAY_OF_REF; } - if (type_mask & MAY_BE_ITERABLE) { - result_mask |= MAY_BE_OBJECT|MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_ANY|MAY_BE_ARRAY_OF_ANY|MAY_BE_ARRAY_OF_REF; - } if (type_mask & MAY_BE_STATIC) { result_mask |= MAY_BE_OBJECT; } diff --git a/Zend/tests/type_declarations/intersection_types/invalid_types/invalid_iterable_type.phpt b/Zend/tests/type_declarations/intersection_types/invalid_types/invalid_iterable_type.phpt index fc4ee2d5607d0..3fd321d394ba4 100644 --- a/Zend/tests/type_declarations/intersection_types/invalid_types/invalid_iterable_type.phpt +++ b/Zend/tests/type_declarations/intersection_types/invalid_types/invalid_iterable_type.phpt @@ -7,4 +7,4 @@ function foo(): iterable&Iterator {} ?> --EXPECTF-- -Fatal error: Type iterable cannot be part of an intersection type in %s on line %d +Fatal error: Type Traversable|array cannot be part of an intersection type in %s on line %d diff --git a/Zend/tests/type_declarations/intersection_types/variance/invalid5.phpt b/Zend/tests/type_declarations/intersection_types/variance/invalid5.phpt index b704f89b909f2..ce3a20fb03ad5 100644 --- a/Zend/tests/type_declarations/intersection_types/variance/invalid5.phpt +++ b/Zend/tests/type_declarations/intersection_types/variance/invalid5.phpt @@ -15,4 +15,4 @@ class Test2 extends Test { ?> --EXPECTF-- -Fatal error: Declaration of Test2::method(): X&Y must be compatible with Test::method(): iterable in %s on line %d +Fatal error: Declaration of Test2::method(): X&Y must be compatible with Test::method(): Traversable|array in %s on line %d diff --git a/Zend/tests/type_declarations/iterable_001.phpt b/Zend/tests/type_declarations/iterable_001.phpt index 10a001dea0253..f75418009086e 100644 --- a/Zend/tests/type_declarations/iterable_001.phpt +++ b/Zend/tests/type_declarations/iterable_001.phpt @@ -45,4 +45,4 @@ object(ArrayIterator)#1 (1) { int(3) } } -test(): Argument #1 ($iterable) must be of type iterable, int given, called in %s on line %d +test(): Argument #1 ($iterable) must be of type Traversable|array, int given, called in %s on line %d diff --git a/Zend/tests/type_declarations/iterable_002.phpt b/Zend/tests/type_declarations/iterable_002.phpt index fdc3b20df5850..d1e1b09d187ac 100644 --- a/Zend/tests/type_declarations/iterable_002.phpt +++ b/Zend/tests/type_declarations/iterable_002.phpt @@ -17,4 +17,4 @@ function baz(iterable $iterable = 1) { ?> --EXPECTF-- -Fatal error: Cannot use int as default value for parameter $iterable of type iterable in %s on line %d +Fatal error: Cannot use int as default value for parameter $iterable of type Traversable|array in %s on line %d diff --git a/Zend/tests/type_declarations/iterable_003.phpt b/Zend/tests/type_declarations/iterable_003.phpt index d2a3bcb368cfd..d7c5b206ebaca 100644 --- a/Zend/tests/type_declarations/iterable_003.phpt +++ b/Zend/tests/type_declarations/iterable_003.phpt @@ -29,4 +29,4 @@ array(0) { } object(Generator)#2 (0) { } -baz(): Return value must be of type iterable, int returned +baz(): Return value must be of type Traversable|array, int returned diff --git a/Zend/tests/type_declarations/iterable_004.phpt b/Zend/tests/type_declarations/iterable_004.phpt index fe9d4461b98b7..8b54482625a27 100644 --- a/Zend/tests/type_declarations/iterable_004.phpt +++ b/Zend/tests/type_declarations/iterable_004.phpt @@ -21,4 +21,4 @@ class Bar extends Foo { ?> --EXPECTF-- -Fatal error: Declaration of Bar::testScalar(iterable $iterable) must be compatible with Foo::testScalar(int $int) in %s on line %d +Fatal error: Declaration of Bar::testScalar(Traversable|array $iterable) must be compatible with Foo::testScalar(int $int) in %s on line %d diff --git a/Zend/tests/type_declarations/iterable_005.phpt b/Zend/tests/type_declarations/iterable_005.phpt index 39dede3b5c31a..2f5fb83f07d7f 100644 --- a/Zend/tests/type_declarations/iterable_005.phpt +++ b/Zend/tests/type_declarations/iterable_005.phpt @@ -29,4 +29,4 @@ class TestScalar extends Test { ?> --EXPECTF-- -Fatal error: Declaration of TestScalar::method(): int must be compatible with Test::method(): iterable in %s on line %d +Fatal error: Declaration of TestScalar::method(): int must be compatible with Test::method(): Traversable|array in %s on line %d diff --git a/Zend/tests/type_declarations/union_types/redundant_types/iterable_and_Traversable.phpt b/Zend/tests/type_declarations/union_types/redundant_types/iterable_and_Traversable.phpt index 5b65a33de1a59..f8d9287be6be7 100644 --- a/Zend/tests/type_declarations/union_types/redundant_types/iterable_and_Traversable.phpt +++ b/Zend/tests/type_declarations/union_types/redundant_types/iterable_and_Traversable.phpt @@ -8,4 +8,4 @@ function test(): iterable|Traversable { ?> --EXPECTF-- -Fatal error: Type Traversable|iterable contains both iterable and Traversable, which is redundant in %s on line %d +Fatal error: Duplicate type Traversable is redundant in %s on line %d diff --git a/Zend/tests/type_declarations/union_types/redundant_types/iterable_and_Traversable_2.phpt b/Zend/tests/type_declarations/union_types/redundant_types/iterable_and_Traversable_2.phpt index e3f7c5858b400..a36d73e3f3083 100644 --- a/Zend/tests/type_declarations/union_types/redundant_types/iterable_and_Traversable_2.phpt +++ b/Zend/tests/type_declarations/union_types/redundant_types/iterable_and_Traversable_2.phpt @@ -8,4 +8,4 @@ function test(): iterable|Traversable|ArrayAccess { ?> --EXPECTF-- -Fatal error: Type Traversable|ArrayAccess|iterable contains both iterable and Traversable, which is redundant in %s on line %d +Fatal error: Duplicate type Traversable is redundant in %s on line %d diff --git a/Zend/tests/type_declarations/union_types/redundant_types/iterable_and_array.phpt b/Zend/tests/type_declarations/union_types/redundant_types/iterable_and_array.phpt index c6b0949418890..ca75ff705edf7 100644 --- a/Zend/tests/type_declarations/union_types/redundant_types/iterable_and_array.phpt +++ b/Zend/tests/type_declarations/union_types/redundant_types/iterable_and_array.phpt @@ -8,4 +8,4 @@ function test(): iterable|array { ?> --EXPECTF-- -Fatal error: Type iterable|array contains both iterable and array, which is redundant in %s on line %d +Fatal error: Duplicate type array is redundant in %s on line %d diff --git a/Zend/tests/typehints/or_null.phpt b/Zend/tests/typehints/or_null.phpt index d7a2e23002690..bd9d93127a579 100644 --- a/Zend/tests/typehints/or_null.phpt +++ b/Zend/tests/typehints/or_null.phpt @@ -247,7 +247,7 @@ TypeError: callableF(): Argument #1 ($param) must be of type ?callable, int give Stack trace: #0 %s(52): callableF(1) #1 {main} -TypeError: iterableF(): Argument #1 ($param) must be of type ?iterable, int given, called in %s:%d +TypeError: iterableF(): Argument #1 ($param) must be of type Traversable|array|null, int given, called in %s:%d Stack trace: #0 %s(60): iterableF(1) #1 {main} @@ -283,7 +283,7 @@ TypeError: returnCallable(): Return value must be of type ?callable, int returne Stack trace: #0 %s(138): returnCallable() #1 {main} -TypeError: returnIterable(): Return value must be of type ?iterable, int returned in %s:%d +TypeError: returnIterable(): Return value must be of type Traversable|array|null, int returned in %s:%d Stack trace: #0 %s(148): returnIterable() #1 {main} @@ -307,7 +307,7 @@ TypeError: returnMissingCallable(): Return value must be of type ?callable, none Stack trace: #0 %s(194): returnMissingCallable() #1 {main} -TypeError: returnMissingIterable(): Return value must be of type ?iterable, none returned in %s:%d +TypeError: returnMissingIterable(): Return value must be of type Traversable|array|null, none returned in %s:%d Stack trace: #0 %s(203): returnMissingIterable() #1 {main} diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 6c06a0a01b932..d0d66c36a464b 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -1227,9 +1227,6 @@ zend_string *zend_type_to_string_resolved(zend_type type, zend_class_entry *scop if (type_mask & MAY_BE_CALLABLE) { str = add_type_string(str, ZSTR_KNOWN(ZEND_STR_CALLABLE), /* is_intersection */ false); } - if (type_mask & MAY_BE_ITERABLE) { - str = add_type_string(str, ZSTR_KNOWN(ZEND_STR_ITERABLE), /* is_intersection */ false); - } if (type_mask & MAY_BE_OBJECT) { str = add_type_string(str, ZSTR_KNOWN(ZEND_STR_OBJECT), /* is_intersection */ false); } @@ -1289,7 +1286,7 @@ static void zend_mark_function_as_generator(void) /* {{{ */ if (CG(active_op_array)->fn_flags & ZEND_ACC_HAS_RETURN_TYPE) { zend_type return_type = CG(active_op_array)->arg_info[-1].type; - bool valid_type = (ZEND_TYPE_FULL_MASK(return_type) & (MAY_BE_ITERABLE | MAY_BE_OBJECT)) != 0; + bool valid_type = (ZEND_TYPE_FULL_MASK(return_type) & MAY_BE_OBJECT) != 0; if (!valid_type) { zend_type *single_type; ZEND_TYPE_FOREACH(return_type, single_type) { @@ -6134,6 +6131,7 @@ static zend_type zend_compile_single_typename(zend_ast *ast) zend_error_noreturn(E_COMPILE_ERROR, "Cannot use \"static\" when no class scope is active"); } + return (zend_type) ZEND_TYPE_INIT_CODE(ast->attr, 0, 0); } else { zend_string *class_name = zend_ast_get_str(ast); @@ -6145,6 +6143,17 @@ static zend_type zend_compile_single_typename(zend_ast *ast) "Type declaration '%s' must be unqualified", ZSTR_VAL(zend_string_tolower(class_name))); } + + /* Transform iterable into a type union alias */ + if (type_code == IS_ITERABLE) { + zend_type iterable = (zend_type) ZEND_TYPE_INIT_CLASS(ZSTR_KNOWN(ZEND_STR_TRAVERSABLE), 0, 0); + ZEND_TYPE_FULL_MASK(iterable) |= MAY_BE_ARRAY; + /* Inform that the type list is a union type */ + ZEND_TYPE_FULL_MASK(iterable) |= _ZEND_TYPE_NAME_BIT; + ZEND_TYPE_FULL_MASK(iterable) |= _ZEND_TYPE_UNION_BIT; + return iterable; + } + return (zend_type) ZEND_TYPE_INIT_CODE(type_code, 0, 0); } else { const char *correct_name; @@ -6184,19 +6193,6 @@ static zend_type zend_compile_single_typename(zend_ast *ast) } } -static bool zend_type_contains_traversable(zend_type type) { - zend_type *single_type; - ZEND_TYPE_FOREACH(type, single_type) { - if (ZEND_TYPE_HAS_NAME(*single_type) - && zend_string_equals_literal_ci(ZEND_TYPE_NAME(*single_type), "Traversable")) { - return 1; - } - } ZEND_TYPE_FOREACH_END(); - return 0; -} - -// TODO: Ideally we'd canonicalize "iterable" into "array|Traversable" and essentially -// treat it as a built-in type alias. static zend_type zend_compile_typename( zend_ast *ast, bool force_allow_null) /* {{{ */ { @@ -6291,7 +6287,7 @@ static zend_type zend_compile_typename( zend_type single_type = zend_compile_single_typename(type_ast); /* An intersection of standard types cannot exist so invalidate it */ - if (ZEND_TYPE_IS_ONLY_MASK(single_type)) { + if (ZEND_TYPE_PURE_MASK(single_type)) { zend_string *standard_type_str = zend_type_to_string(single_type); zend_error_noreturn(E_COMPILE_ERROR, "Type %s cannot be part of an intersection type", ZSTR_VAL(standard_type_str)); @@ -6329,18 +6325,6 @@ static zend_type zend_compile_typename( } uint32_t type_mask = ZEND_TYPE_PURE_MASK(type); - if ((type_mask & (MAY_BE_ARRAY|MAY_BE_ITERABLE)) == (MAY_BE_ARRAY|MAY_BE_ITERABLE)) { - zend_string *type_str = zend_type_to_string(type); - zend_error_noreturn(E_COMPILE_ERROR, - "Type %s contains both iterable and array, which is redundant", ZSTR_VAL(type_str)); - } - - if ((type_mask & MAY_BE_ITERABLE) && zend_type_contains_traversable(type)) { - zend_string *type_str = zend_type_to_string(type); - zend_error_noreturn(E_COMPILE_ERROR, - "Type %s contains both iterable and Traversable, which is redundant", - ZSTR_VAL(type_str)); - } if (type_mask == MAY_BE_ANY && is_marked_nullable) { zend_error_noreturn(E_COMPILE_ERROR, "Type mixed cannot be marked as nullable since mixed already includes null"); @@ -6387,9 +6371,6 @@ static bool zend_is_valid_default_value(zend_type type, zval *value) convert_to_double(value); return 1; } - if ((ZEND_TYPE_FULL_MASK(type) & MAY_BE_ITERABLE) && Z_TYPE_P(value) == IS_ARRAY) { - return 1; - } return 0; } diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index 7b55fa5e8ac21..7e52348cb2ff5 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -909,9 +909,6 @@ static zend_always_inline bool i_zend_check_property_type(zend_property_info *in uint32_t type_mask = ZEND_TYPE_FULL_MASK(info->type); ZEND_ASSERT(!(type_mask & (MAY_BE_CALLABLE|MAY_BE_STATIC))); - if ((type_mask & MAY_BE_ITERABLE) && zend_is_iterable(property)) { - return 1; - } return zend_verify_scalar_type_hint(type_mask, property, strict, 0); } @@ -1048,9 +1045,6 @@ static zend_always_inline bool zend_check_type_slow( if ((type_mask & MAY_BE_CALLABLE) && zend_is_callable(arg, 0, NULL)) { return 1; } - if ((type_mask & MAY_BE_ITERABLE) && zend_is_iterable(arg)) { - return 1; - } if ((type_mask & MAY_BE_STATIC) && zend_value_instanceof_static(arg)) { return 1; } @@ -2929,7 +2923,7 @@ static zend_always_inline bool check_type_array_assignable(zend_type type) { if (!ZEND_TYPE_IS_SET(type)) { return 1; } - return (ZEND_TYPE_FULL_MASK(type) & (MAY_BE_ITERABLE|MAY_BE_ARRAY)) != 0; + return (ZEND_TYPE_FULL_MASK(type) & MAY_BE_ARRAY) != 0; } /* Checks whether an array can be assigned to the reference. Throws error if not assignable. */ @@ -3378,9 +3372,6 @@ static zend_always_inline int i_zend_verify_type_assignable_zval( type_mask = ZEND_TYPE_FULL_MASK(type); ZEND_ASSERT(!(type_mask & (MAY_BE_CALLABLE|MAY_BE_STATIC))); - if (type_mask & MAY_BE_ITERABLE) { - return zend_is_iterable(zv); - } /* SSTH Exception: IS_LONG may be accepted as IS_DOUBLE (converted) */ if (strict) { diff --git a/Zend/zend_inheritance.c b/Zend/zend_inheritance.c index 3921ee35fe0d6..1b0d57b2e7cae 100644 --- a/Zend/zend_inheritance.c +++ b/Zend/zend_inheritance.c @@ -328,21 +328,6 @@ static bool unlinked_instanceof(zend_class_entry *ce1, zend_class_entry *ce2) { return 0; } -static bool zend_type_contains_traversable(zend_type type) { - zend_type *single_type; - if (ZEND_TYPE_FULL_MASK(type) & MAY_BE_OBJECT) { - return 1; - } - - ZEND_TYPE_FOREACH(type, single_type) { - if (ZEND_TYPE_HAS_NAME(*single_type) - && zend_string_equals_literal_ci(ZEND_TYPE_NAME(*single_type), "Traversable")) { - return 1; - } - } ZEND_TYPE_FOREACH_END(); - return 0; -} - static bool zend_type_permits_self( zend_type type, zend_class_entry *scope, zend_class_entry *self) { if (ZEND_TYPE_FULL_MASK(type) & MAY_BE_OBJECT) { @@ -473,15 +458,6 @@ static inheritance_status zend_is_class_subtype_of_type( return INHERITANCE_SUCCESS; } } - if (ZEND_TYPE_FULL_MASK(proto_type) & MAY_BE_ITERABLE) { - if (!fe_ce) fe_ce = lookup_class(fe_scope, fe_class_name); - if (!fe_ce) { - have_unresolved = 1; - } else if (unlinked_instanceof(fe_ce, zend_ce_traversable)) { - track_class_dependency(fe_ce, fe_class_name); - return INHERITANCE_SUCCESS; - } - } zend_type *single_type; @@ -567,18 +543,6 @@ static inheritance_status zend_perform_covariant_type_check( uint32_t proto_type_mask = ZEND_TYPE_PURE_MASK(proto_type); uint32_t added_types = fe_type_mask & ~proto_type_mask; if (added_types) { - // TODO: Make "iterable" an alias of "array|Traversable" instead, - // so these special cases will be handled automatically. - if ((added_types & MAY_BE_ITERABLE) - && (proto_type_mask & MAY_BE_ARRAY) - && zend_type_contains_traversable(proto_type)) { - /* Replacing array|Traversable with iterable is okay */ - added_types &= ~MAY_BE_ITERABLE; - } - if ((added_types & MAY_BE_ARRAY) && (proto_type_mask & MAY_BE_ITERABLE)) { - /* Replacing iterable with array is okay */ - added_types &= ~MAY_BE_ARRAY; - } if ((added_types & MAY_BE_STATIC) && zend_type_permits_self(proto_type, proto_scope, fe_scope)) { /* Replacing type that accepts self with static is okay */ @@ -605,8 +569,7 @@ static inheritance_status zend_perform_covariant_type_check( * We still perform a class lookup for forward-compatibility reasons, * as we may have named types in the future that are not classes * (such as typedefs). */ - if (proto_type_mask & (MAY_BE_OBJECT|MAY_BE_ITERABLE)) { - bool any_class = (proto_type_mask & MAY_BE_OBJECT) != 0; + if (proto_type_mask & MAY_BE_OBJECT) { ZEND_TYPE_FOREACH(fe_type, single_type) { zend_string *fe_class_name = get_class_from_type(fe_scope, *single_type); if (!fe_class_name) { @@ -614,10 +577,8 @@ static inheritance_status zend_perform_covariant_type_check( } zend_class_entry *fe_ce = lookup_class(fe_scope, fe_class_name); if (fe_ce) { - if (any_class || unlinked_instanceof(fe_ce, zend_ce_traversable)) { - track_class_dependency(fe_ce, fe_class_name); - return INHERITANCE_SUCCESS; - } + track_class_dependency(fe_ce, fe_class_name); + return INHERITANCE_SUCCESS; } else { have_unresolved = true; } diff --git a/Zend/zend_string.h b/Zend/zend_string.h index 1a1c0cd7a67bf..7c346077a3adc 100644 --- a/Zend/zend_string.h +++ b/Zend/zend_string.h @@ -580,6 +580,7 @@ EMPTY_SWITCH_DEFAULT_CASE() _(ZEND_STR_FALSE, "false") \ _(ZEND_STR_NULL_LOWERCASE, "null") \ _(ZEND_STR_MIXED, "mixed") \ + _(ZEND_STR_TRAVERSABLE, "Traversable") \ _(ZEND_STR_SLEEP, "__sleep") \ _(ZEND_STR_WAKEUP, "__wakeup") \ _(ZEND_STR_CASES, "cases") \ diff --git a/Zend/zend_type_info.h b/Zend/zend_type_info.h index 93048a777bdb3..f9780181a4c67 100644 --- a/Zend/zend_type_info.h +++ b/Zend/zend_type_info.h @@ -38,7 +38,6 @@ /* These are used in zend_type, but not for type inference. * They are allowed to overlap with types used during inference. */ #define MAY_BE_CALLABLE (1 << IS_CALLABLE) -#define MAY_BE_ITERABLE (1 << IS_ITERABLE) #define MAY_BE_VOID (1 << IS_VOID) #define MAY_BE_NEVER (1 << IS_NEVER) #define MAY_BE_STATIC (1 << IS_STATIC) diff --git a/ext/opcache/jit/zend_jit_arm64.dasc b/ext/opcache/jit/zend_jit_arm64.dasc index ec50f6edd8deb..112f007f3d192 100644 --- a/ext/opcache/jit/zend_jit_arm64.dasc +++ b/ext/opcache/jit/zend_jit_arm64.dasc @@ -12232,7 +12232,7 @@ static int zend_jit_fetch_obj(dasm_State **Dst, uint32_t flags = opline->extended_value & ZEND_FETCH_OBJ_FLAGS; if (flags == ZEND_FETCH_DIM_WRITE) { - if ((ZEND_TYPE_FULL_MASK(prop_info->type) & (MAY_BE_ITERABLE|MAY_BE_ARRAY)) == 0) { + if ((ZEND_TYPE_FULL_MASK(prop_info->type) & MAY_BE_ARRAY) == 0) { if (!type_loaded) { type_loaded = 1; | MEM_ACCESS_32_WITH_UOFFSET ldr, REG2w, FCARG1x, (prop_info->offset + offsetof(zval,u1.type_info)), TMP1 diff --git a/ext/opcache/jit/zend_jit_helpers.c b/ext/opcache/jit/zend_jit_helpers.c index 9ec73892d5475..955d8fc1cfc53 100644 --- a/ext/opcache/jit/zend_jit_helpers.c +++ b/ext/opcache/jit/zend_jit_helpers.c @@ -1949,7 +1949,7 @@ static zend_always_inline bool check_type_array_assignable(zend_type type) { if (!ZEND_TYPE_IS_SET(type)) { return 1; } - return (ZEND_TYPE_FULL_MASK(type) & (MAY_BE_ITERABLE|MAY_BE_ARRAY)) != 0; + return (ZEND_TYPE_FULL_MASK(type) & MAY_BE_ARRAY) != 0; } static zend_property_info *zend_object_fetch_property_type_info( @@ -2094,7 +2094,7 @@ static void ZEND_FASTCALL zend_jit_check_array_promotion(zval *val, zend_propert if ((Z_TYPE_P(val) <= IS_FALSE || (Z_ISREF_P(val) && Z_TYPE_P(Z_REFVAL_P(val)) <= IS_FALSE)) && ZEND_TYPE_IS_SET(prop->type) - && (ZEND_TYPE_FULL_MASK(prop->type) & (MAY_BE_ITERABLE|MAY_BE_ARRAY)) == 0) { + && (ZEND_TYPE_FULL_MASK(prop->type) & MAY_BE_ARRAY) == 0) { zend_string *type_str = zend_type_to_string(prop->type); zend_type_error( "Cannot auto-initialize an array inside property %s::$%s of type %s", diff --git a/ext/opcache/jit/zend_jit_x86.dasc b/ext/opcache/jit/zend_jit_x86.dasc index c4a715b306e57..c33a4912d7b51 100644 --- a/ext/opcache/jit/zend_jit_x86.dasc +++ b/ext/opcache/jit/zend_jit_x86.dasc @@ -12962,7 +12962,7 @@ static int zend_jit_fetch_obj(dasm_State **Dst, uint32_t flags = opline->extended_value & ZEND_FETCH_OBJ_FLAGS; if (flags == ZEND_FETCH_DIM_WRITE) { - if ((ZEND_TYPE_FULL_MASK(prop_info->type) & (MAY_BE_ITERABLE|MAY_BE_ARRAY)) == 0) { + if ((ZEND_TYPE_FULL_MASK(prop_info->type) & MAY_BE_ARRAY) == 0) { if (!type_loaded) { type_loaded = 1; | mov edx, dword [FCARG1a + prop_info->offset + 8] diff --git a/ext/opcache/tests/iterable_type_optimization.phpt b/ext/opcache/tests/iterable_type_optimization.phpt index 277df8f374c26..340fcdea22811 100644 --- a/ext/opcache/tests/iterable_type_optimization.phpt +++ b/ext/opcache/tests/iterable_type_optimization.phpt @@ -12,7 +12,7 @@ test(new stdClass); ?> --EXPECTF-- -Fatal error: Uncaught TypeError: test(): Return value must be of type iterable, stdClass returned in %s:%d +Fatal error: Uncaught TypeError: test(): Return value must be of type Traversable|array, stdClass returned in %s:%d Stack trace: #0 %s(%d): test(Object(stdClass)) #1 {main} diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index 8c7118bda6d89..e8abbb78882f7 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -3103,9 +3103,6 @@ ZEND_METHOD(ReflectionUnionType, getTypes) if (type_mask & MAY_BE_CALLABLE) { append_type_mask(return_value, MAY_BE_CALLABLE); } - if (type_mask & MAY_BE_ITERABLE) { - append_type_mask(return_value, MAY_BE_ITERABLE); - } if (type_mask & MAY_BE_OBJECT) { append_type_mask(return_value, MAY_BE_OBJECT); } diff --git a/ext/reflection/tests/ReflectionClass_isArray.phpt b/ext/reflection/tests/ReflectionClass_isArray.phpt index 67df4e98e7542..e21465c407299 100644 --- a/ext/reflection/tests/ReflectionClass_isArray.phpt +++ b/ext/reflection/tests/ReflectionClass_isArray.phpt @@ -21,7 +21,7 @@ Deprecated: Method ReflectionParameter::isArray() is deprecated in %s on line %d bool(true) Deprecated: Method ReflectionParameter::isArray() is deprecated in %s on line %d -bool(false) +bool(true) Deprecated: Method ReflectionParameter::isArray() is deprecated in %s on line %d bool(false) diff --git a/ext/reflection/tests/ReflectionType_001.phpt b/ext/reflection/tests/ReflectionType_001.phpt index d0f327d0466ff..7289b6b552b7a 100644 --- a/ext/reflection/tests/ReflectionType_001.phpt +++ b/ext/reflection/tests/ReflectionType_001.phpt @@ -90,8 +90,13 @@ $reflector = new ReflectionClass(PropTypeTest::class); foreach ($reflector->getProperties() as $name => $property) { if ($property->hasType()) { - printf("public %s $%s;\n", - $property->getType()->getName(), $property->getName()); + $type = $property->getType(); + if ($type instanceof ReflectionNamedType) { + printf("public %s $%s;\n", $type->getName(), $property->getName()); + } else { + echo 'public ', implode('|', $type->getTypes()), + ' $', $property->getName(), "\n"; + } } else printf("public $%s;\n", $property->getName()); } @@ -216,7 +221,7 @@ string(4) "Test" public int $int; public string $string; public array $arr; -public iterable $iterable; +public Traversable|array $iterable public stdClass $std; public OtherThing $other; public $mixed; diff --git a/ext/reflection/tests/ReflectionType_possible_types.phpt b/ext/reflection/tests/ReflectionType_possible_types.phpt index dd6d39300b590..ac0ea4c3697de 100644 --- a/ext/reflection/tests/ReflectionType_possible_types.phpt +++ b/ext/reflection/tests/ReflectionType_possible_types.phpt @@ -20,7 +20,11 @@ $functions = [ foreach ($functions as $function) { $reflectionFunc = new ReflectionFunction($function); $returnType = $reflectionFunc->getReturnType(); - var_dump($returnType->getName()); + if ($returnType instanceof ReflectionNamedType) { + var_dump($returnType->getName()); + } else { + var_dump(implode('|', $returnType->getTypes())); + } } ?> --EXPECT-- diff --git a/ext/reflection/tests/bug72661.phpt b/ext/reflection/tests/bug72661.phpt index b1cb764beb62a..b07db2f37b582 100644 --- a/ext/reflection/tests/bug72661.phpt +++ b/ext/reflection/tests/bug72661.phpt @@ -7,4 +7,4 @@ function test(iterable $arg) { } var_dump((string)(new ReflectionParameter("test", 0))->getType()); ?> --EXPECT-- -string(8) "iterable" +string(17) "Traversable|array" diff --git a/ext/reflection/tests/union_types.phpt b/ext/reflection/tests/union_types.phpt index a3ac53b54ab29..e670567712f3b 100644 --- a/ext/reflection/tests/union_types.phpt +++ b/ext/reflection/tests/union_types.phpt @@ -75,13 +75,16 @@ Allows null: true Name: null String: null Allows Null: true -Type X|iterable|bool: +Type X|Traversable|array|bool: Allows null: false Name: X String: X Allows Null: false - Name: iterable - String: iterable + Name: Traversable + String: Traversable + Allows Null: false + Name: array + String: array Allows Null: false Name: bool String: bool From ca2d21baa2e5bce425f04c9947e73939f9c20e4b Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Wed, 28 Jul 2021 19:52:49 +0200 Subject: [PATCH 02/28] BC support for Reflection --- Zend/zend_compile.c | 4 ++- Zend/zend_type_info.h | 2 ++ ext/reflection/php_reflection.c | 26 ++++++++++++++++--- .../tests/ReflectionClass_isArray.phpt | 2 +- ext/reflection/tests/ReflectionType_001.phpt | 4 +-- ext/reflection/tests/bug72661.phpt | 2 +- 6 files changed, 32 insertions(+), 8 deletions(-) diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index d0d66c36a464b..94f0b7361e58b 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -6147,9 +6147,11 @@ static zend_type zend_compile_single_typename(zend_ast *ast) /* Transform iterable into a type union alias */ if (type_code == IS_ITERABLE) { zend_type iterable = (zend_type) ZEND_TYPE_INIT_CLASS(ZSTR_KNOWN(ZEND_STR_TRAVERSABLE), 0, 0); + ZEND_TYPE_FULL_MASK(iterable) |= _ZEND_TYPE_NAME_BIT; ZEND_TYPE_FULL_MASK(iterable) |= MAY_BE_ARRAY; + /* Set MAY_BE_ITERABLE for BC compat during Reflection */ + ZEND_TYPE_FULL_MASK(iterable) |= MAY_BE_ITERABLE; /* Inform that the type list is a union type */ - ZEND_TYPE_FULL_MASK(iterable) |= _ZEND_TYPE_NAME_BIT; ZEND_TYPE_FULL_MASK(iterable) |= _ZEND_TYPE_UNION_BIT; return iterable; } diff --git a/Zend/zend_type_info.h b/Zend/zend_type_info.h index f9780181a4c67..e9b50ca7d7e0c 100644 --- a/Zend/zend_type_info.h +++ b/Zend/zend_type_info.h @@ -38,6 +38,8 @@ /* These are used in zend_type, but not for type inference. * They are allowed to overlap with types used during inference. */ #define MAY_BE_CALLABLE (1 << IS_CALLABLE) +/* Kept as BC for reflection */ +#define MAY_BE_ITERABLE (1 << IS_ITERABLE) #define MAY_BE_VOID (1 << IS_VOID) #define MAY_BE_NEVER (1 << IS_NEVER) #define MAY_BE_STATIC (1 << IS_STATIC) diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index e8abbb78882f7..987be27a1a895 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -1330,6 +1330,7 @@ typedef enum { } reflection_type_kind; /* For backwards compatibility reasons, we need to return T|null style unions + * and transformation from iterable to Traversable|array * as a ReflectionNamedType. Here we determine what counts as a union type and * what doesn't. */ static reflection_type_kind get_type_kind(zend_type type) { @@ -1344,6 +1345,10 @@ static reflection_type_kind get_type_kind(zend_type type) { } if (ZEND_TYPE_IS_COMPLEX(type)) { + /* BC support for 'iterable' type */ + if (type_mask_without_null == (MAY_BE_ARRAY|MAY_BE_ITERABLE)) { + return NAMED_TYPE; + } if (type_mask_without_null != 0) { return UNION_TYPE; } @@ -1373,6 +1378,10 @@ static void reflection_type_factory(zend_type type, zval *object, bool legacy_be reflection_instantiate(reflection_intersection_type_ptr, object); break; case UNION_TYPE: + /* Clear fake iterable type */ + if ((ZEND_TYPE_PURE_MASK(type) & MAY_BE_ITERABLE) != 0) { + ZEND_TYPE_FULL_MASK(type) &= ~MAY_BE_ITERABLE; + } reflection_instantiate(reflection_union_type_ptr, object); break; case NAMED_TYPE: @@ -3006,9 +3015,17 @@ ZEND_METHOD(ReflectionType, allowsNull) } /* }}} */ +/* BC for iterable */ +static zend_string *zend_type_to_string_ex(zend_type type) { + if (UNEXPECTED((ZEND_TYPE_PURE_MASK(type) & MAY_BE_ITERABLE) != 0)) { + return ZSTR_KNOWN(ZEND_STR_ITERABLE); + } + return zend_type_to_string(type); +} + static zend_string *zend_type_to_string_without_null(zend_type type) { ZEND_TYPE_FULL_MASK(type) &= ~MAY_BE_NULL; - return zend_type_to_string(type); + return zend_type_to_string_ex(type); } /* {{{ Return the text of the type hint */ @@ -3022,7 +3039,7 @@ ZEND_METHOD(ReflectionType, __toString) } GET_REFLECTION_OBJECT_PTR(param); - RETURN_STR(zend_type_to_string(param->type)); + RETURN_STR(zend_type_to_string_ex(param->type)); } /* }}} */ @@ -3040,7 +3057,7 @@ ZEND_METHOD(ReflectionNamedType, getName) if (param->legacy_behavior) { RETURN_STR(zend_type_to_string_without_null(param->type)); } - RETURN_STR(zend_type_to_string(param->type)); + RETURN_STR(zend_type_to_string_ex(param->type)); } /* }}} */ @@ -3103,6 +3120,9 @@ ZEND_METHOD(ReflectionUnionType, getTypes) if (type_mask & MAY_BE_CALLABLE) { append_type_mask(return_value, MAY_BE_CALLABLE); } + if (type_mask & MAY_BE_ITERABLE) { + append_type_mask(return_value, MAY_BE_ITERABLE); + } if (type_mask & MAY_BE_OBJECT) { append_type_mask(return_value, MAY_BE_OBJECT); } diff --git a/ext/reflection/tests/ReflectionClass_isArray.phpt b/ext/reflection/tests/ReflectionClass_isArray.phpt index e21465c407299..67df4e98e7542 100644 --- a/ext/reflection/tests/ReflectionClass_isArray.phpt +++ b/ext/reflection/tests/ReflectionClass_isArray.phpt @@ -21,7 +21,7 @@ Deprecated: Method ReflectionParameter::isArray() is deprecated in %s on line %d bool(true) Deprecated: Method ReflectionParameter::isArray() is deprecated in %s on line %d -bool(true) +bool(false) Deprecated: Method ReflectionParameter::isArray() is deprecated in %s on line %d bool(false) diff --git a/ext/reflection/tests/ReflectionType_001.phpt b/ext/reflection/tests/ReflectionType_001.phpt index 7289b6b552b7a..d52df9f6129d5 100644 --- a/ext/reflection/tests/ReflectionType_001.phpt +++ b/ext/reflection/tests/ReflectionType_001.phpt @@ -95,7 +95,7 @@ foreach ($reflector->getProperties() as $name => $property) { printf("public %s $%s;\n", $type->getName(), $property->getName()); } else { echo 'public ', implode('|', $type->getTypes()), - ' $', $property->getName(), "\n"; + ' $', $property->getName(), ";\n"; } } else printf("public $%s;\n", $property->getName()); } @@ -221,7 +221,7 @@ string(4) "Test" public int $int; public string $string; public array $arr; -public Traversable|array $iterable +public iterable $iterable; public stdClass $std; public OtherThing $other; public $mixed; diff --git a/ext/reflection/tests/bug72661.phpt b/ext/reflection/tests/bug72661.phpt index b07db2f37b582..b1cb764beb62a 100644 --- a/ext/reflection/tests/bug72661.phpt +++ b/ext/reflection/tests/bug72661.phpt @@ -7,4 +7,4 @@ function test(iterable $arg) { } var_dump((string)(new ReflectionParameter("test", 0))->getType()); ?> --EXPECT-- -string(17) "Traversable|array" +string(8) "iterable" From 842c34f709ccd51d27095739717f02531ac10b4b Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Wed, 28 Jul 2021 22:42:08 +0200 Subject: [PATCH 03/28] Fix variance --- Zend/zend_inheritance.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Zend/zend_inheritance.c b/Zend/zend_inheritance.c index 1b0d57b2e7cae..cfbb1f3e6f63d 100644 --- a/Zend/zend_inheritance.c +++ b/Zend/zend_inheritance.c @@ -541,7 +541,8 @@ static inheritance_status zend_perform_covariant_type_check( /* Builtin types may be removed, but not added */ uint32_t fe_type_mask = ZEND_TYPE_PURE_MASK(fe_type); uint32_t proto_type_mask = ZEND_TYPE_PURE_MASK(proto_type); - uint32_t added_types = fe_type_mask & ~proto_type_mask; + /* MAY_BE_ITERABLE is only used for BC with Reflection so remove it */ + uint32_t added_types = fe_type_mask & ~proto_type_mask & ~MAY_BE_ITERABLE; if (added_types) { if ((added_types & MAY_BE_STATIC) && zend_type_permits_self(proto_type, proto_scope, fe_scope)) { From 905510b2928e10f22e3d0d1d881c169169326bf1 Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Wed, 11 Aug 2021 15:37:31 +0200 Subject: [PATCH 04/28] Use unused type bit for flagging iterable --- Zend/zend_compile.c | 4 ++-- Zend/zend_inheritance.c | 3 +-- Zend/zend_type_info.h | 2 -- Zend/zend_types.h | 5 ++++- ext/reflection/php_reflection.c | 16 +++++++--------- ext/reflection/tests/union_types.phpt | 4 ++-- 6 files changed, 16 insertions(+), 18 deletions(-) diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 94f0b7361e58b..eb44996cf1b18 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -6149,8 +6149,8 @@ static zend_type zend_compile_single_typename(zend_ast *ast) zend_type iterable = (zend_type) ZEND_TYPE_INIT_CLASS(ZSTR_KNOWN(ZEND_STR_TRAVERSABLE), 0, 0); ZEND_TYPE_FULL_MASK(iterable) |= _ZEND_TYPE_NAME_BIT; ZEND_TYPE_FULL_MASK(iterable) |= MAY_BE_ARRAY; - /* Set MAY_BE_ITERABLE for BC compat during Reflection */ - ZEND_TYPE_FULL_MASK(iterable) |= MAY_BE_ITERABLE; + /* Set iterable bit for BC compat during Reflection */ + ZEND_TYPE_FULL_MASK(iterable) |= _ZEND_TYPE_ITERABLE_BIT; /* Inform that the type list is a union type */ ZEND_TYPE_FULL_MASK(iterable) |= _ZEND_TYPE_UNION_BIT; return iterable; diff --git a/Zend/zend_inheritance.c b/Zend/zend_inheritance.c index cfbb1f3e6f63d..1b0d57b2e7cae 100644 --- a/Zend/zend_inheritance.c +++ b/Zend/zend_inheritance.c @@ -541,8 +541,7 @@ static inheritance_status zend_perform_covariant_type_check( /* Builtin types may be removed, but not added */ uint32_t fe_type_mask = ZEND_TYPE_PURE_MASK(fe_type); uint32_t proto_type_mask = ZEND_TYPE_PURE_MASK(proto_type); - /* MAY_BE_ITERABLE is only used for BC with Reflection so remove it */ - uint32_t added_types = fe_type_mask & ~proto_type_mask & ~MAY_BE_ITERABLE; + uint32_t added_types = fe_type_mask & ~proto_type_mask; if (added_types) { if ((added_types & MAY_BE_STATIC) && zend_type_permits_self(proto_type, proto_scope, fe_scope)) { diff --git a/Zend/zend_type_info.h b/Zend/zend_type_info.h index e9b50ca7d7e0c..f9780181a4c67 100644 --- a/Zend/zend_type_info.h +++ b/Zend/zend_type_info.h @@ -38,8 +38,6 @@ /* These are used in zend_type, but not for type inference. * They are allowed to overlap with types used during inference. */ #define MAY_BE_CALLABLE (1 << IS_CALLABLE) -/* Kept as BC for reflection */ -#define MAY_BE_ITERABLE (1 << IS_ITERABLE) #define MAY_BE_VOID (1 << IS_VOID) #define MAY_BE_NEVER (1 << IS_NEVER) #define MAY_BE_STATIC (1 << IS_STATIC) diff --git a/Zend/zend_types.h b/Zend/zend_types.h index 151afadec2258..772116b1a48b0 100644 --- a/Zend/zend_types.h +++ b/Zend/zend_types.h @@ -144,7 +144,7 @@ typedef struct { #define _ZEND_TYPE_NAME_BIT (1u << 24) #define _ZEND_TYPE_LIST_BIT (1u << 22) #define _ZEND_TYPE_KIND_MASK (_ZEND_TYPE_LIST_BIT|_ZEND_TYPE_NAME_BIT) -/* TODO: bit 21 is not used */ +#define _ZEND_TYPE_ITERABLE_BIT (1u << 21) /* Whether the type list is arena allocated */ #define _ZEND_TYPE_ARENA_BIT (1u << 20) /* Whether the type list is an intersection type */ @@ -170,6 +170,9 @@ typedef struct { #define ZEND_TYPE_HAS_LIST(t) \ ((((t).type_mask) & _ZEND_TYPE_LIST_BIT) != 0) +#define ZEND_TYPE_IS_ITERABLE_FALLBACK(t) \ + ((((t).type_mask) & _ZEND_TYPE_ITERABLE_BIT) != 0) + #define ZEND_TYPE_IS_INTERSECTION(t) \ ((((t).type_mask) & _ZEND_TYPE_INTERSECTION_BIT) != 0) diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index 987be27a1a895..c87120dde2ca9 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -1346,7 +1346,7 @@ static reflection_type_kind get_type_kind(zend_type type) { if (ZEND_TYPE_IS_COMPLEX(type)) { /* BC support for 'iterable' type */ - if (type_mask_without_null == (MAY_BE_ARRAY|MAY_BE_ITERABLE)) { + if (UNEXPECTED(ZEND_TYPE_IS_ITERABLE_FALLBACK(type))) { return NAMED_TYPE; } if (type_mask_without_null != 0) { @@ -1378,10 +1378,6 @@ static void reflection_type_factory(zend_type type, zval *object, bool legacy_be reflection_instantiate(reflection_intersection_type_ptr, object); break; case UNION_TYPE: - /* Clear fake iterable type */ - if ((ZEND_TYPE_PURE_MASK(type) & MAY_BE_ITERABLE) != 0) { - ZEND_TYPE_FULL_MASK(type) &= ~MAY_BE_ITERABLE; - } reflection_instantiate(reflection_union_type_ptr, object); break; case NAMED_TYPE: @@ -2735,6 +2731,11 @@ ZEND_METHOD(ReflectionParameter, isArray) } GET_REFLECTION_OBJECT_PTR(param); + /* BC For iterable */ + if (ZEND_TYPE_IS_ITERABLE_FALLBACK(param->arg_info->type)) { + RETURN_FALSE; + } + type_mask = ZEND_TYPE_PURE_MASK_WITHOUT_NULL(param->arg_info->type); RETVAL_BOOL(type_mask == MAY_BE_ARRAY); } @@ -3017,7 +3018,7 @@ ZEND_METHOD(ReflectionType, allowsNull) /* BC for iterable */ static zend_string *zend_type_to_string_ex(zend_type type) { - if (UNEXPECTED((ZEND_TYPE_PURE_MASK(type) & MAY_BE_ITERABLE) != 0)) { + if (UNEXPECTED(ZEND_TYPE_IS_ITERABLE_FALLBACK(type))) { return ZSTR_KNOWN(ZEND_STR_ITERABLE); } return zend_type_to_string(type); @@ -3120,9 +3121,6 @@ ZEND_METHOD(ReflectionUnionType, getTypes) if (type_mask & MAY_BE_CALLABLE) { append_type_mask(return_value, MAY_BE_CALLABLE); } - if (type_mask & MAY_BE_ITERABLE) { - append_type_mask(return_value, MAY_BE_ITERABLE); - } if (type_mask & MAY_BE_OBJECT) { append_type_mask(return_value, MAY_BE_OBJECT); } diff --git a/ext/reflection/tests/union_types.phpt b/ext/reflection/tests/union_types.phpt index e670567712f3b..2545f2ee9f9a6 100644 --- a/ext/reflection/tests/union_types.phpt +++ b/ext/reflection/tests/union_types.phpt @@ -80,8 +80,8 @@ Allows null: false Name: X String: X Allows Null: false - Name: Traversable - String: Traversable + Name: iterable + String: iterable Allows Null: false Name: array String: array From b00a2a6e89ca700f80ec9ee6ce84957cd3d95b27 Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Wed, 11 Aug 2021 15:47:05 +0200 Subject: [PATCH 05/28] Fix slightly union types Reflection test This is still a bit weird --- ext/reflection/php_reflection.c | 6 +++++- ext/reflection/tests/union_types.phpt | 3 --- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index c87120dde2ca9..bc4ed72c1c9e1 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -3095,6 +3095,7 @@ ZEND_METHOD(ReflectionUnionType, getTypes) reflection_object *intern; type_reference *param; uint32_t type_mask; + bool has_iterable = false; if (zend_parse_parameters_none() == FAILURE) { RETURN_THROWS(); @@ -3105,6 +3106,9 @@ ZEND_METHOD(ReflectionUnionType, getTypes) if (ZEND_TYPE_HAS_LIST(param->type)) { zend_type *list_type; ZEND_TYPE_LIST_FOREACH(ZEND_TYPE_LIST(param->type), list_type) { + if (UNEXPECTED(ZEND_TYPE_IS_ITERABLE_FALLBACK(*list_type))) { + has_iterable = true; + } append_type(return_value, *list_type); } ZEND_TYPE_LIST_FOREACH_END(); } else if (ZEND_TYPE_HAS_NAME(param->type)) { @@ -3124,7 +3128,7 @@ ZEND_METHOD(ReflectionUnionType, getTypes) if (type_mask & MAY_BE_OBJECT) { append_type_mask(return_value, MAY_BE_OBJECT); } - if (type_mask & MAY_BE_ARRAY) { + if ((type_mask & MAY_BE_ARRAY) && !has_iterable) { append_type_mask(return_value, MAY_BE_ARRAY); } if (type_mask & MAY_BE_STRING) { diff --git a/ext/reflection/tests/union_types.phpt b/ext/reflection/tests/union_types.phpt index 2545f2ee9f9a6..927b080818e8b 100644 --- a/ext/reflection/tests/union_types.phpt +++ b/ext/reflection/tests/union_types.phpt @@ -83,9 +83,6 @@ Allows null: false Name: iterable String: iterable Allows Null: false - Name: array - String: array - Allows Null: false Name: bool String: bool Allows Null: false From fd55485423122c35f26ce3decaa2fdc0d24bfbe9 Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Thu, 12 Aug 2021 03:17:03 +0200 Subject: [PATCH 06/28] Point to iterable for incompatible type in intersection --- .../invalid_types/invalid_iterable_type.phpt | 2 +- Zend/zend_compile.c | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Zend/tests/type_declarations/intersection_types/invalid_types/invalid_iterable_type.phpt b/Zend/tests/type_declarations/intersection_types/invalid_types/invalid_iterable_type.phpt index 3fd321d394ba4..fc4ee2d5607d0 100644 --- a/Zend/tests/type_declarations/intersection_types/invalid_types/invalid_iterable_type.phpt +++ b/Zend/tests/type_declarations/intersection_types/invalid_types/invalid_iterable_type.phpt @@ -7,4 +7,4 @@ function foo(): iterable&Iterator {} ?> --EXPECTF-- -Fatal error: Type Traversable|array cannot be part of an intersection type in %s on line %d +Fatal error: Type iterable cannot be part of an intersection type in %s on line %d diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index eb44996cf1b18..87aed69e8aea1 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -6289,7 +6289,11 @@ static zend_type zend_compile_typename( zend_type single_type = zend_compile_single_typename(type_ast); /* An intersection of standard types cannot exist so invalidate it */ - if (ZEND_TYPE_PURE_MASK(single_type)) { + /* Check for iterable early */ + if (ZEND_TYPE_IS_ITERABLE_FALLBACK(single_type)) { + zend_error_noreturn(E_COMPILE_ERROR, "Type iterable cannot be part of an intersection type"); + } + if (ZEND_TYPE_IS_ONLY_MASK(single_type)) { zend_string *standard_type_str = zend_type_to_string(single_type); zend_error_noreturn(E_COMPILE_ERROR, "Type %s cannot be part of an intersection type", ZSTR_VAL(standard_type_str)); From e427ef8eb61a07dca80572c542679a2d549f4953 Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Tue, 14 Sep 2021 17:53:53 +0100 Subject: [PATCH 07/28] Fix iterable type for internal functions --- Zend/zend_execute.c | 5 +++++ Zend/zend_types.h | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index 7e52348cb2ff5..29cc1d992545a 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -1042,6 +1042,11 @@ static zend_always_inline bool zend_check_type_slow( } type_mask = ZEND_TYPE_FULL_MASK(*type); + /* Fallback for iterable */ + // TODO Fix gen_stubs + if ((type_mask & _ZEND_TYPE_ITERABLE_BIT) && zend_is_iterable(arg)) { + return 1; + } if ((type_mask & MAY_BE_CALLABLE) && zend_is_callable(arg, 0, NULL)) { return 1; } diff --git a/Zend/zend_types.h b/Zend/zend_types.h index 772116b1a48b0..f512964ca4844 100644 --- a/Zend/zend_types.h +++ b/Zend/zend_types.h @@ -266,8 +266,8 @@ typedef struct { { NULL, (_type_mask) } #define ZEND_TYPE_INIT_CODE(code, allow_null, extra_flags) \ - ZEND_TYPE_INIT_MASK(((code) == _IS_BOOL ? MAY_BE_BOOL : ((code) == IS_MIXED ? MAY_BE_ANY : (1 << (code)))) \ - | ((allow_null) ? _ZEND_TYPE_NULLABLE_BIT : 0) | (extra_flags)) + ZEND_TYPE_INIT_MASK(((code) == _IS_BOOL ? MAY_BE_BOOL : ( (code) == IS_ITERABLE ? _ZEND_TYPE_ITERABLE_BIT : ((code) == IS_MIXED ? MAY_BE_ANY : (1 << (code))))) \ + | ((allow_null) ? _ZEND_TYPE_NULLABLE_BIT : 0) | (extra_flags)) \ #define ZEND_TYPE_INIT_PTR(ptr, type_kind, allow_null, extra_flags) \ { (void *) (ptr), \ From 3635821bb44cf08d1ef56f70b889add98ebcf568 Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Tue, 14 Sep 2021 20:13:44 +0100 Subject: [PATCH 08/28] Start of a working stub generation --- build/gen_stub.php | 18 ++++++++++++------ ext/zend_test/test_arginfo.h | 4 ++-- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/build/gen_stub.php b/build/gen_stub.php index 320fe087ab895..7e68f91b24ce0 100755 --- a/build/gen_stub.php +++ b/build/gen_stub.php @@ -219,7 +219,6 @@ public static function fromString(string $typeString): SimpleType case "float": case "string": case "callable": - case "iterable": case "object": case "resource": case "mixed": @@ -231,6 +230,8 @@ public static function fromString(string $typeString): SimpleType return ArrayType::createGenericArray(); case "self": throw new Exception('The exact class name must be used instead of "self"'); + case "iterable": + throw new Exception('This should not happen'); } $matches = []; @@ -369,8 +370,6 @@ public function toTypeCode(): string { return "IS_VOID"; case "callable": return "IS_CALLABLE"; - case "iterable": - return "IS_ITERABLE"; case "mixed": return "IS_MIXED"; case "static": @@ -408,8 +407,6 @@ public function toTypeMask(): string { return "MAY_BE_OBJECT"; case "callable": return "MAY_BE_CALLABLE"; - case "iterable": - return "MAY_BE_ITERABLE"; case "mixed": return "MAY_BE_ANY"; case "void": @@ -515,12 +512,21 @@ public static function fromNode(Node $node): Type { if ($node instanceof Node\NullableType) { return new Type( [ - SimpleType::fromNode($node->type), + ...Type::fromNode($node->type)->types, SimpleType::null(), ] ); } + if ($node instanceof Node\Identifier && $node->toLowerString() === "iterable") { + return new Type( + [ + SimpleType::fromString("Traversable"), + ArrayType::createGenericArray(), + ] + ); + } + return new Type([SimpleType::fromNode($node)]); } diff --git a/ext/zend_test/test_arginfo.h b/ext/zend_test/test_arginfo.h index 0c575cf002ae0..d682b53755096 100644 --- a/ext/zend_test/test_arginfo.h +++ b/ext/zend_test/test_arginfo.h @@ -53,8 +53,8 @@ ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_zend_string_or_stdclass_or_n ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_zend_iterable, 0, 1, IS_VOID, 0) - ZEND_ARG_TYPE_INFO(0, arg1, IS_ITERABLE, 0) - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, arg2, IS_ITERABLE, 1, "null") + ZEND_ARG_OBJ_TYPE_MASK(0, arg1, Traversable, MAY_BE_ARRAY, NULL) + ZEND_ARG_OBJ_TYPE_MASK(0, arg2, Traversable, MAY_BE_ARRAY|MAY_BE_NULL, "null") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_zend_weakmap_attach, 0, 2, _IS_BOOL, 0) From 3a9326af24c234fec05ccd19ae4294a1c85146a7 Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Tue, 14 Sep 2021 20:19:34 +0100 Subject: [PATCH 09/28] Possibly generic handling of types? --- build/gen_stub.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/build/gen_stub.php b/build/gen_stub.php index 7e68f91b24ce0..647426a2c65bf 100755 --- a/build/gen_stub.php +++ b/build/gen_stub.php @@ -506,7 +506,12 @@ class Type { public static function fromNode(Node $node): Type { if ($node instanceof Node\UnionType) { - return new Type(array_map(['SimpleType', 'fromNode'], $node->types)); + $nestedTypeObjects = array_map(['Type', 'fromNode'], $node->types); + $types = []; + foreach ($nestedTypeObjects as $typeObject) { + array_push($types, ...$typeObject->types); + } + return new Type($types); } if ($node instanceof Node\NullableType) { From 280cbf0ca7d6ebb4e89dd1bf82d53ed9a14dc533 Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Wed, 20 Apr 2022 10:47:28 +0100 Subject: [PATCH 10/28] Ammend test3 --- ext/reflection/tests/ReflectionType_possible_types.phpt | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/ext/reflection/tests/ReflectionType_possible_types.phpt b/ext/reflection/tests/ReflectionType_possible_types.phpt index ac0ea4c3697de..dd6d39300b590 100644 --- a/ext/reflection/tests/ReflectionType_possible_types.phpt +++ b/ext/reflection/tests/ReflectionType_possible_types.phpt @@ -20,11 +20,7 @@ $functions = [ foreach ($functions as $function) { $reflectionFunc = new ReflectionFunction($function); $returnType = $reflectionFunc->getReturnType(); - if ($returnType instanceof ReflectionNamedType) { - var_dump($returnType->getName()); - } else { - var_dump(implode('|', $returnType->getTypes())); - } + var_dump($returnType->getName()); } ?> --EXPECT-- From 1ff4c9988c5da782a29f0221ebaae57bc3a8e3a3 Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Wed, 20 Apr 2022 11:41:05 +0100 Subject: [PATCH 11/28] Use iterable instead of array|Traversable when usage of single type --- .../intersection_types/variance/invalid5.phpt | 2 +- .../tests/type_declarations/iterable_001.phpt | 2 +- .../tests/type_declarations/iterable_002.phpt | 2 +- .../tests/type_declarations/iterable_003.phpt | 2 +- .../tests/type_declarations/iterable_004.phpt | 2 +- .../tests/type_declarations/iterable_005.phpt | 2 +- Zend/zend_compile.c | 19 +++++++++++++++++++ Zend/zend_execute.c | 5 ----- Zend/zend_types.h | 1 + 9 files changed, 26 insertions(+), 11 deletions(-) diff --git a/Zend/tests/type_declarations/intersection_types/variance/invalid5.phpt b/Zend/tests/type_declarations/intersection_types/variance/invalid5.phpt index ce3a20fb03ad5..b704f89b909f2 100644 --- a/Zend/tests/type_declarations/intersection_types/variance/invalid5.phpt +++ b/Zend/tests/type_declarations/intersection_types/variance/invalid5.phpt @@ -15,4 +15,4 @@ class Test2 extends Test { ?> --EXPECTF-- -Fatal error: Declaration of Test2::method(): X&Y must be compatible with Test::method(): Traversable|array in %s on line %d +Fatal error: Declaration of Test2::method(): X&Y must be compatible with Test::method(): iterable in %s on line %d diff --git a/Zend/tests/type_declarations/iterable_001.phpt b/Zend/tests/type_declarations/iterable_001.phpt index f75418009086e..10a001dea0253 100644 --- a/Zend/tests/type_declarations/iterable_001.phpt +++ b/Zend/tests/type_declarations/iterable_001.phpt @@ -45,4 +45,4 @@ object(ArrayIterator)#1 (1) { int(3) } } -test(): Argument #1 ($iterable) must be of type Traversable|array, int given, called in %s on line %d +test(): Argument #1 ($iterable) must be of type iterable, int given, called in %s on line %d diff --git a/Zend/tests/type_declarations/iterable_002.phpt b/Zend/tests/type_declarations/iterable_002.phpt index d1e1b09d187ac..fdc3b20df5850 100644 --- a/Zend/tests/type_declarations/iterable_002.phpt +++ b/Zend/tests/type_declarations/iterable_002.phpt @@ -17,4 +17,4 @@ function baz(iterable $iterable = 1) { ?> --EXPECTF-- -Fatal error: Cannot use int as default value for parameter $iterable of type Traversable|array in %s on line %d +Fatal error: Cannot use int as default value for parameter $iterable of type iterable in %s on line %d diff --git a/Zend/tests/type_declarations/iterable_003.phpt b/Zend/tests/type_declarations/iterable_003.phpt index d7c5b206ebaca..d2a3bcb368cfd 100644 --- a/Zend/tests/type_declarations/iterable_003.phpt +++ b/Zend/tests/type_declarations/iterable_003.phpt @@ -29,4 +29,4 @@ array(0) { } object(Generator)#2 (0) { } -baz(): Return value must be of type Traversable|array, int returned +baz(): Return value must be of type iterable, int returned diff --git a/Zend/tests/type_declarations/iterable_004.phpt b/Zend/tests/type_declarations/iterable_004.phpt index 8b54482625a27..fe9d4461b98b7 100644 --- a/Zend/tests/type_declarations/iterable_004.phpt +++ b/Zend/tests/type_declarations/iterable_004.phpt @@ -21,4 +21,4 @@ class Bar extends Foo { ?> --EXPECTF-- -Fatal error: Declaration of Bar::testScalar(Traversable|array $iterable) must be compatible with Foo::testScalar(int $int) in %s on line %d +Fatal error: Declaration of Bar::testScalar(iterable $iterable) must be compatible with Foo::testScalar(int $int) in %s on line %d diff --git a/Zend/tests/type_declarations/iterable_005.phpt b/Zend/tests/type_declarations/iterable_005.phpt index 2f5fb83f07d7f..39dede3b5c31a 100644 --- a/Zend/tests/type_declarations/iterable_005.phpt +++ b/Zend/tests/type_declarations/iterable_005.phpt @@ -29,4 +29,4 @@ class TestScalar extends Test { ?> --EXPECTF-- -Fatal error: Declaration of TestScalar::method(): int must be compatible with Test::method(): Traversable|array in %s on line %d +Fatal error: Declaration of TestScalar::method(): int must be compatible with Test::method(): iterable in %s on line %d diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 87aed69e8aea1..945f0a1d08540 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -1194,6 +1194,25 @@ static zend_string *resolve_class_name(zend_string *name, zend_class_entry *scop zend_string *zend_type_to_string_resolved(zend_type type, zend_class_entry *scope) { zend_string *str = NULL; + // TODO also handle case when iterable is in a union type? + // This would allow to remove the zend_type_to_string_ex() shim in Reflection + /* BC for iterable type */ + if (UNEXPECTED(ZEND_TYPE_IS_ITERABLE_FALLBACK(type)) && ZEND_TYPE_HAS_NAME(type)) { + uint32_t type_mask = ZEND_TYPE_PURE_MASK(type); + if (type_mask != MAY_BE_ARRAY && type_mask != MAY_BE_ARRAY|MAY_BE_NULL) { + goto standard_resolve; + } + str = add_type_string(str, ZSTR_KNOWN(ZEND_STR_ITERABLE), /* is_intersection */ false); + + if (type_mask == MAY_BE_NULL) { + zend_string *nullable_str = zend_string_concat2("?", 1, ZSTR_VAL(str), ZSTR_LEN(str)); + zend_string_release(str); + return nullable_str; + } + return str; + } + + standard_resolve: if (ZEND_TYPE_HAS_LIST(type)) { zend_type *list_type; bool is_intersection = ZEND_TYPE_IS_INTERSECTION(type); diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index 29cc1d992545a..7e52348cb2ff5 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -1042,11 +1042,6 @@ static zend_always_inline bool zend_check_type_slow( } type_mask = ZEND_TYPE_FULL_MASK(*type); - /* Fallback for iterable */ - // TODO Fix gen_stubs - if ((type_mask & _ZEND_TYPE_ITERABLE_BIT) && zend_is_iterable(arg)) { - return 1; - } if ((type_mask & MAY_BE_CALLABLE) && zend_is_callable(arg, 0, NULL)) { return 1; } diff --git a/Zend/zend_types.h b/Zend/zend_types.h index f512964ca4844..ad444b2b4e528 100644 --- a/Zend/zend_types.h +++ b/Zend/zend_types.h @@ -144,6 +144,7 @@ typedef struct { #define _ZEND_TYPE_NAME_BIT (1u << 24) #define _ZEND_TYPE_LIST_BIT (1u << 22) #define _ZEND_TYPE_KIND_MASK (_ZEND_TYPE_LIST_BIT|_ZEND_TYPE_NAME_BIT) +/* For BC behaviour with iterable type */ #define _ZEND_TYPE_ITERABLE_BIT (1u << 21) /* Whether the type list is arena allocated */ #define _ZEND_TYPE_ARENA_BIT (1u << 20) From fd1460438d4d89e2846a338a626d576f506e83cd Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Wed, 20 Apr 2022 12:29:58 +0100 Subject: [PATCH 12/28] Handle iterable in complex union types --- Zend/tests/typehints/or_null.phpt | 6 ++-- Zend/zend_compile.c | 37 ++++++++++---------- ext/reflection/php_reflection.c | 15 +++----- ext/reflection/tests/ReflectionType_001.phpt | 9 ++--- ext/reflection/tests/union_types.phpt | 2 +- 5 files changed, 28 insertions(+), 41 deletions(-) diff --git a/Zend/tests/typehints/or_null.phpt b/Zend/tests/typehints/or_null.phpt index bd9d93127a579..d7a2e23002690 100644 --- a/Zend/tests/typehints/or_null.phpt +++ b/Zend/tests/typehints/or_null.phpt @@ -247,7 +247,7 @@ TypeError: callableF(): Argument #1 ($param) must be of type ?callable, int give Stack trace: #0 %s(52): callableF(1) #1 {main} -TypeError: iterableF(): Argument #1 ($param) must be of type Traversable|array|null, int given, called in %s:%d +TypeError: iterableF(): Argument #1 ($param) must be of type ?iterable, int given, called in %s:%d Stack trace: #0 %s(60): iterableF(1) #1 {main} @@ -283,7 +283,7 @@ TypeError: returnCallable(): Return value must be of type ?callable, int returne Stack trace: #0 %s(138): returnCallable() #1 {main} -TypeError: returnIterable(): Return value must be of type Traversable|array|null, int returned in %s:%d +TypeError: returnIterable(): Return value must be of type ?iterable, int returned in %s:%d Stack trace: #0 %s(148): returnIterable() #1 {main} @@ -307,7 +307,7 @@ TypeError: returnMissingCallable(): Return value must be of type ?callable, none Stack trace: #0 %s(194): returnMissingCallable() #1 {main} -TypeError: returnMissingIterable(): Return value must be of type Traversable|array|null, none returned in %s:%d +TypeError: returnMissingIterable(): Return value must be of type ?iterable, none returned in %s:%d Stack trace: #0 %s(203): returnMissingIterable() #1 {main} diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 945f0a1d08540..908dade6f9368 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -1193,41 +1193,40 @@ static zend_string *resolve_class_name(zend_string *name, zend_class_entry *scop zend_string *zend_type_to_string_resolved(zend_type type, zend_class_entry *scope) { zend_string *str = NULL; + uint32_t type_mask = ZEND_TYPE_PURE_MASK(type); + bool has_name = ZEND_TYPE_HAS_NAME(type); - // TODO also handle case when iterable is in a union type? - // This would allow to remove the zend_type_to_string_ex() shim in Reflection - /* BC for iterable type */ - if (UNEXPECTED(ZEND_TYPE_IS_ITERABLE_FALLBACK(type)) && ZEND_TYPE_HAS_NAME(type)) { - uint32_t type_mask = ZEND_TYPE_PURE_MASK(type); - if (type_mask != MAY_BE_ARRAY && type_mask != MAY_BE_ARRAY|MAY_BE_NULL) { - goto standard_resolve; - } + /* BC for iterable type as a single type */ + if (UNEXPECTED(ZEND_TYPE_IS_ITERABLE_FALLBACK(type))) { str = add_type_string(str, ZSTR_KNOWN(ZEND_STR_ITERABLE), /* is_intersection */ false); - - if (type_mask == MAY_BE_NULL) { - zend_string *nullable_str = zend_string_concat2("?", 1, ZSTR_VAL(str), ZSTR_LEN(str)); - zend_string_release(str); - return nullable_str; + /* Remove array bit */ + type_mask &= ~MAY_BE_ARRAY; + /* If it has a type name it must be Traversable, ignore it */ + if (has_name) { + has_name = false; } - return str; } - standard_resolve: if (ZEND_TYPE_HAS_LIST(type)) { zend_type *list_type; bool is_intersection = ZEND_TYPE_IS_INTERSECTION(type); ZEND_TYPE_LIST_FOREACH(ZEND_TYPE_LIST(type), list_type) { zend_string *name = ZEND_TYPE_NAME(*list_type); + /* BC for iterable type in a union type */ + if (UNEXPECTED(ZEND_TYPE_IS_ITERABLE_FALLBACK(*list_type) && zend_string_equals(name, ZSTR_KNOWN(ZEND_STR_TRAVERSABLE)))) { + /* Remove array bit */ + type_mask &= ~MAY_BE_ARRAY; + str = add_type_string(str, ZSTR_KNOWN(ZEND_STR_ITERABLE), /* is_intersection */ false); + continue; + } zend_string *resolved = resolve_class_name(name, scope); str = add_type_string(str, resolved, is_intersection); zend_string_release(resolved); } ZEND_TYPE_LIST_FOREACH_END(); - } else if (ZEND_TYPE_HAS_NAME(type)) { + } else if (has_name) { str = resolve_class_name(ZEND_TYPE_NAME(type), scope); } - uint32_t type_mask = ZEND_TYPE_PURE_MASK(type); - if (type_mask == MAY_BE_ANY) { str = add_type_string(str, ZSTR_KNOWN(ZEND_STR_MIXED), /* is_intersection */ false); @@ -6168,7 +6167,7 @@ static zend_type zend_compile_single_typename(zend_ast *ast) zend_type iterable = (zend_type) ZEND_TYPE_INIT_CLASS(ZSTR_KNOWN(ZEND_STR_TRAVERSABLE), 0, 0); ZEND_TYPE_FULL_MASK(iterable) |= _ZEND_TYPE_NAME_BIT; ZEND_TYPE_FULL_MASK(iterable) |= MAY_BE_ARRAY; - /* Set iterable bit for BC compat during Reflection */ + /* Set iterable bit for BC compat during Reflection and string representation of type */ ZEND_TYPE_FULL_MASK(iterable) |= _ZEND_TYPE_ITERABLE_BIT; /* Inform that the type list is a union type */ ZEND_TYPE_FULL_MASK(iterable) |= _ZEND_TYPE_UNION_BIT; diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index bc4ed72c1c9e1..8091dcbf429a6 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -3016,17 +3016,9 @@ ZEND_METHOD(ReflectionType, allowsNull) } /* }}} */ -/* BC for iterable */ -static zend_string *zend_type_to_string_ex(zend_type type) { - if (UNEXPECTED(ZEND_TYPE_IS_ITERABLE_FALLBACK(type))) { - return ZSTR_KNOWN(ZEND_STR_ITERABLE); - } - return zend_type_to_string(type); -} - static zend_string *zend_type_to_string_without_null(zend_type type) { ZEND_TYPE_FULL_MASK(type) &= ~MAY_BE_NULL; - return zend_type_to_string_ex(type); + return zend_type_to_string(type); } /* {{{ Return the text of the type hint */ @@ -3040,7 +3032,7 @@ ZEND_METHOD(ReflectionType, __toString) } GET_REFLECTION_OBJECT_PTR(param); - RETURN_STR(zend_type_to_string_ex(param->type)); + RETURN_STR(zend_type_to_string(param->type)); } /* }}} */ @@ -3058,7 +3050,7 @@ ZEND_METHOD(ReflectionNamedType, getName) if (param->legacy_behavior) { RETURN_STR(zend_type_to_string_without_null(param->type)); } - RETURN_STR(zend_type_to_string_ex(param->type)); + RETURN_STR(zend_type_to_string(param->type)); } /* }}} */ @@ -3106,6 +3098,7 @@ ZEND_METHOD(ReflectionUnionType, getTypes) if (ZEND_TYPE_HAS_LIST(param->type)) { zend_type *list_type; ZEND_TYPE_LIST_FOREACH(ZEND_TYPE_LIST(param->type), list_type) { + /* BC for iterable type */ if (UNEXPECTED(ZEND_TYPE_IS_ITERABLE_FALLBACK(*list_type))) { has_iterable = true; } diff --git a/ext/reflection/tests/ReflectionType_001.phpt b/ext/reflection/tests/ReflectionType_001.phpt index d52df9f6129d5..d0f327d0466ff 100644 --- a/ext/reflection/tests/ReflectionType_001.phpt +++ b/ext/reflection/tests/ReflectionType_001.phpt @@ -90,13 +90,8 @@ $reflector = new ReflectionClass(PropTypeTest::class); foreach ($reflector->getProperties() as $name => $property) { if ($property->hasType()) { - $type = $property->getType(); - if ($type instanceof ReflectionNamedType) { - printf("public %s $%s;\n", $type->getName(), $property->getName()); - } else { - echo 'public ', implode('|', $type->getTypes()), - ' $', $property->getName(), ";\n"; - } + printf("public %s $%s;\n", + $property->getType()->getName(), $property->getName()); } else printf("public $%s;\n", $property->getName()); } diff --git a/ext/reflection/tests/union_types.phpt b/ext/reflection/tests/union_types.phpt index 927b080818e8b..a3ac53b54ab29 100644 --- a/ext/reflection/tests/union_types.phpt +++ b/ext/reflection/tests/union_types.phpt @@ -75,7 +75,7 @@ Allows null: true Name: null String: null Allows Null: true -Type X|Traversable|array|bool: +Type X|iterable|bool: Allows null: false Name: X String: X From fcecc297f32342c1c85d2001fce48ca86733547a Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Wed, 20 Apr 2022 15:53:57 +0100 Subject: [PATCH 13/28] Fix opcache test --- ext/opcache/tests/iterable_type_optimization.phpt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/opcache/tests/iterable_type_optimization.phpt b/ext/opcache/tests/iterable_type_optimization.phpt index 340fcdea22811..277df8f374c26 100644 --- a/ext/opcache/tests/iterable_type_optimization.phpt +++ b/ext/opcache/tests/iterable_type_optimization.phpt @@ -12,7 +12,7 @@ test(new stdClass); ?> --EXPECTF-- -Fatal error: Uncaught TypeError: test(): Return value must be of type Traversable|array, stdClass returned in %s:%d +Fatal error: Uncaught TypeError: test(): Return value must be of type iterable, stdClass returned in %s:%d Stack trace: #0 %s(%d): test(Object(stdClass)) #1 {main} From 8b548a2a4531777480214b338981bb35de32d650 Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Sat, 23 Apr 2022 12:54:00 +0100 Subject: [PATCH 14/28] Address review and drop BC shim for unions --- Zend/tests/return_types/generators001.phpt | 7 ++ .../intersection_types/variance/invalid5.phpt | 2 +- .../{ => iterable}/iterable_001.phpt | 2 +- .../{ => iterable}/iterable_002.phpt | 2 +- .../{ => iterable}/iterable_003.phpt | 2 +- .../{ => iterable}/iterable_004.phpt | 2 +- .../{ => iterable}/iterable_005.phpt | 2 +- .../type_declarations/iterable/or_null.phpt | 46 +++++++++++ Zend/tests/typehints/or_null.phpt | 81 +++++-------------- Zend/zend_compile.c | 18 ----- Zend/zend_types.h | 2 +- ext/reflection/php_reflection.c | 7 +- ext/reflection/tests/ReflectionType_001.phpt | 2 - .../tests/ReflectionType_possible_types.phpt | 2 - ext/reflection/tests/bug72661.phpt | 2 +- ext/reflection/tests/iterable_Reflection.phpt | 33 ++++++++ ext/reflection/tests/union_types.phpt | 9 ++- 17 files changed, 122 insertions(+), 99 deletions(-) rename Zend/tests/type_declarations/{ => iterable}/iterable_001.phpt (84%) rename Zend/tests/type_declarations/{ => iterable}/iterable_002.phpt (89%) rename Zend/tests/type_declarations/{ => iterable}/iterable_003.phpt (84%) rename Zend/tests/type_declarations/{ => iterable}/iterable_004.phpt (74%) rename Zend/tests/type_declarations/{ => iterable}/iterable_005.phpt (88%) create mode 100644 Zend/tests/type_declarations/iterable/or_null.phpt create mode 100644 ext/reflection/tests/iterable_Reflection.phpt diff --git a/Zend/tests/return_types/generators001.phpt b/Zend/tests/return_types/generators001.phpt index 64793eaa00ff1..615dabc240bee 100644 --- a/Zend/tests/return_types/generators001.phpt +++ b/Zend/tests/return_types/generators001.phpt @@ -26,6 +26,10 @@ function test6() : object|callable { yield 6; } +function test7() : iterable { + yield 7; +} + var_dump( test1(), test2(), @@ -33,6 +37,7 @@ var_dump( test4(), test5(), test6(), + test7(), ); ?> --EXPECTF-- @@ -48,3 +53,5 @@ object(Generator)#%d (%d) { } object(Generator)#%d (%d) { } +object(Generator)#%d (%d) { +} diff --git a/Zend/tests/type_declarations/intersection_types/variance/invalid5.phpt b/Zend/tests/type_declarations/intersection_types/variance/invalid5.phpt index b704f89b909f2..ce3a20fb03ad5 100644 --- a/Zend/tests/type_declarations/intersection_types/variance/invalid5.phpt +++ b/Zend/tests/type_declarations/intersection_types/variance/invalid5.phpt @@ -15,4 +15,4 @@ class Test2 extends Test { ?> --EXPECTF-- -Fatal error: Declaration of Test2::method(): X&Y must be compatible with Test::method(): iterable in %s on line %d +Fatal error: Declaration of Test2::method(): X&Y must be compatible with Test::method(): Traversable|array in %s on line %d diff --git a/Zend/tests/type_declarations/iterable_001.phpt b/Zend/tests/type_declarations/iterable/iterable_001.phpt similarity index 84% rename from Zend/tests/type_declarations/iterable_001.phpt rename to Zend/tests/type_declarations/iterable/iterable_001.phpt index 10a001dea0253..f75418009086e 100644 --- a/Zend/tests/type_declarations/iterable_001.phpt +++ b/Zend/tests/type_declarations/iterable/iterable_001.phpt @@ -45,4 +45,4 @@ object(ArrayIterator)#1 (1) { int(3) } } -test(): Argument #1 ($iterable) must be of type iterable, int given, called in %s on line %d +test(): Argument #1 ($iterable) must be of type Traversable|array, int given, called in %s on line %d diff --git a/Zend/tests/type_declarations/iterable_002.phpt b/Zend/tests/type_declarations/iterable/iterable_002.phpt similarity index 89% rename from Zend/tests/type_declarations/iterable_002.phpt rename to Zend/tests/type_declarations/iterable/iterable_002.phpt index fdc3b20df5850..d1e1b09d187ac 100644 --- a/Zend/tests/type_declarations/iterable_002.phpt +++ b/Zend/tests/type_declarations/iterable/iterable_002.phpt @@ -17,4 +17,4 @@ function baz(iterable $iterable = 1) { ?> --EXPECTF-- -Fatal error: Cannot use int as default value for parameter $iterable of type iterable in %s on line %d +Fatal error: Cannot use int as default value for parameter $iterable of type Traversable|array in %s on line %d diff --git a/Zend/tests/type_declarations/iterable_003.phpt b/Zend/tests/type_declarations/iterable/iterable_003.phpt similarity index 84% rename from Zend/tests/type_declarations/iterable_003.phpt rename to Zend/tests/type_declarations/iterable/iterable_003.phpt index d2a3bcb368cfd..d7c5b206ebaca 100644 --- a/Zend/tests/type_declarations/iterable_003.phpt +++ b/Zend/tests/type_declarations/iterable/iterable_003.phpt @@ -29,4 +29,4 @@ array(0) { } object(Generator)#2 (0) { } -baz(): Return value must be of type iterable, int returned +baz(): Return value must be of type Traversable|array, int returned diff --git a/Zend/tests/type_declarations/iterable_004.phpt b/Zend/tests/type_declarations/iterable/iterable_004.phpt similarity index 74% rename from Zend/tests/type_declarations/iterable_004.phpt rename to Zend/tests/type_declarations/iterable/iterable_004.phpt index fe9d4461b98b7..8b54482625a27 100644 --- a/Zend/tests/type_declarations/iterable_004.phpt +++ b/Zend/tests/type_declarations/iterable/iterable_004.phpt @@ -21,4 +21,4 @@ class Bar extends Foo { ?> --EXPECTF-- -Fatal error: Declaration of Bar::testScalar(iterable $iterable) must be compatible with Foo::testScalar(int $int) in %s on line %d +Fatal error: Declaration of Bar::testScalar(Traversable|array $iterable) must be compatible with Foo::testScalar(int $int) in %s on line %d diff --git a/Zend/tests/type_declarations/iterable_005.phpt b/Zend/tests/type_declarations/iterable/iterable_005.phpt similarity index 88% rename from Zend/tests/type_declarations/iterable_005.phpt rename to Zend/tests/type_declarations/iterable/iterable_005.phpt index 39dede3b5c31a..2f5fb83f07d7f 100644 --- a/Zend/tests/type_declarations/iterable_005.phpt +++ b/Zend/tests/type_declarations/iterable/iterable_005.phpt @@ -29,4 +29,4 @@ class TestScalar extends Test { ?> --EXPECTF-- -Fatal error: Declaration of TestScalar::method(): int must be compatible with Test::method(): iterable in %s on line %d +Fatal error: Declaration of TestScalar::method(): int must be compatible with Test::method(): Traversable|array in %s on line %d diff --git a/Zend/tests/type_declarations/iterable/or_null.phpt b/Zend/tests/type_declarations/iterable/or_null.phpt new file mode 100644 index 0000000000000..286f1e291db71 --- /dev/null +++ b/Zend/tests/type_declarations/iterable/or_null.phpt @@ -0,0 +1,46 @@ +--TEST-- +Test "or null"/"or be null" in type-checking errors for userland functions with iterable +--FILE-- + +--EXPECTF-- +TypeError: iterableF(): Argument #1 ($param) must be of type Traversable|array|null, int given, called in %s on line %d and defined in %s:%d +Stack trace: +#0 %s(%d): iterableF(1) +#1 {main} +TypeError: returnIterable(): Return value must be of type Traversable|array|null, int returned in %s:%d +Stack trace: +#0 %s(%d): returnIterable() +#1 {main} +TypeError: returnMissingIterable(): Return value must be of type Traversable|array|null, none returned in %s:%d +Stack trace: +#0 %s(%d): returnMissingIterable() +#1 {main} diff --git a/Zend/tests/typehints/or_null.phpt b/Zend/tests/typehints/or_null.phpt index d7a2e23002690..279a04aaff102 100644 --- a/Zend/tests/typehints/or_null.phpt +++ b/Zend/tests/typehints/or_null.phpt @@ -57,14 +57,6 @@ try { echo $e, PHP_EOL; } -function iterableF(?iterable $param) {} - -try { - iterableF(1); -} catch (\TypeError $e) { - echo $e, PHP_EOL; -} - function intF(?int $param) {} try { @@ -143,16 +135,6 @@ try { echo $e, PHP_EOL; } -function returnIterable(): ?iterable { - return 1; -} - -try { - returnIterable(); -} catch (\TypeError $e) { - echo $e, PHP_EOL; -} - function returnInt(): ?int { return new \StdClass; } @@ -199,15 +181,6 @@ try { echo $e, PHP_EOL; } -function returnMissingIterable(): ?iterable { -} - -try { - returnMissingIterable(); -} catch (\TypeError $e) { - echo $e, PHP_EOL; -} - function returnMissingInt(): ?int { } @@ -221,97 +194,85 @@ try { --EXPECTF-- TypeError: unloadedClass(): Argument #1 ($param) must be of type ?I\Dont\Exist, stdClass given, called in %s:%d Stack trace: -#0 %s(8): unloadedClass(Object(stdClass)) +#0 %s(%d): unloadedClass(Object(stdClass)) #1 {main} TypeError: loadedClass(): Argument #1 ($param) must be of type ?RealClass, stdClass given, called in %s:%d Stack trace: -#0 %s(20): loadedClass(Object(stdClass)) +#0 %s(%d): loadedClass(Object(stdClass)) #1 {main} TypeError: loadedInterface(): Argument #1 ($param) must be of type ?RealInterface, stdClass given, called in %s:%d Stack trace: -#0 %s(26): loadedInterface(Object(stdClass)) +#0 %s(%d): loadedInterface(Object(stdClass)) #1 {main} TypeError: unloadedClass(): Argument #1 ($param) must be of type ?I\Dont\Exist, int given, called in %s:%d Stack trace: -#0 %s(32): unloadedClass(1) +#0 %s(%d): unloadedClass(1) #1 {main} TypeError: loadedClass(): Argument #1 ($param) must be of type ?RealClass, int given, called in %s:%d Stack trace: -#0 %s(38): loadedClass(1) +#0 %s(%d): loadedClass(1) #1 {main} TypeError: loadedInterface(): Argument #1 ($param) must be of type ?RealInterface, int given, called in %s:%d Stack trace: -#0 %s(44): loadedInterface(1) +#0 %s(%d): loadedInterface(1) #1 {main} TypeError: callableF(): Argument #1 ($param) must be of type ?callable, int given, called in %s:%d Stack trace: -#0 %s(52): callableF(1) -#1 {main} -TypeError: iterableF(): Argument #1 ($param) must be of type ?iterable, int given, called in %s:%d -Stack trace: -#0 %s(60): iterableF(1) +#0 %s(%d): callableF(1) #1 {main} TypeError: intF(): Argument #1 ($param) must be of type ?int, stdClass given, called in %s:%d Stack trace: -#0 %s(68): intF(Object(stdClass)) +#0 %s(%d): intF(Object(stdClass)) #1 {main} TypeError: returnUnloadedClass(): Return value must be of type ?I\Dont\Exist, stdClass returned in %s:%d Stack trace: -#0 %s(78): returnUnloadedClass() +#0 %s(%d): returnUnloadedClass() #1 {main} TypeError: returnLoadedClass(): Return value must be of type ?RealClass, stdClass returned in %s:%d Stack trace: -#0 %s(88): returnLoadedClass() +#0 %s(%d): returnLoadedClass() #1 {main} TypeError: returnLoadedInterface(): Return value must be of type ?RealInterface, stdClass returned in %s:%d Stack trace: -#0 %s(98): returnLoadedInterface() +#0 %s(%d): returnLoadedInterface() #1 {main} TypeError: returnUnloadedClassScalar(): Return value must be of type ?I\Dont\Exist, int returned in %s:%d Stack trace: -#0 %s(108): returnUnloadedClassScalar() +#0 %s(%d): returnUnloadedClassScalar() #1 {main} TypeError: returnLoadedClassScalar(): Return value must be of type ?RealClass, int returned in %s:%d Stack trace: -#0 %s(118): returnLoadedClassScalar() +#0 %s(%d): returnLoadedClassScalar() #1 {main} TypeError: returnLoadedInterfaceScalar(): Return value must be of type ?RealInterface, int returned in %s:%d Stack trace: -#0 %s(128): returnLoadedInterfaceScalar() +#0 %s(%d): returnLoadedInterfaceScalar() #1 {main} TypeError: returnCallable(): Return value must be of type ?callable, int returned in %s:%d Stack trace: -#0 %s(138): returnCallable() -#1 {main} -TypeError: returnIterable(): Return value must be of type ?iterable, int returned in %s:%d -Stack trace: -#0 %s(148): returnIterable() +#0 %s(%d): returnCallable() #1 {main} TypeError: returnInt(): Return value must be of type ?int, stdClass returned in %s:%d Stack trace: -#0 %s(158): returnInt() +#0 %s(%d): returnInt() #1 {main} TypeError: returnMissingUnloadedClass(): Return value must be of type ?I\Dont\Exist, none returned in %s:%d Stack trace: -#0 %s(167): returnMissingUnloadedClass() +#0 %s(%d): returnMissingUnloadedClass() #1 {main} TypeError: returnMissingLoadedClass(): Return value must be of type ?RealClass, none returned in %s:%d Stack trace: -#0 %s(176): returnMissingLoadedClass() +#0 %s(%d): returnMissingLoadedClass() #1 {main} TypeError: returnMissingLoadedInterface(): Return value must be of type ?RealInterface, none returned in %s:%d Stack trace: -#0 %s(185): returnMissingLoadedInterface() +#0 %s(%d): returnMissingLoadedInterface() #1 {main} TypeError: returnMissingCallable(): Return value must be of type ?callable, none returned in %s:%d Stack trace: -#0 %s(194): returnMissingCallable() -#1 {main} -TypeError: returnMissingIterable(): Return value must be of type ?iterable, none returned in %s:%d -Stack trace: -#0 %s(203): returnMissingIterable() +#0 %s(%d): returnMissingCallable() #1 {main} TypeError: returnMissingInt(): Return value must be of type ?int, none returned in %s:%d Stack trace: -#0 %s(212): returnMissingInt() +#0 %s(%d): returnMissingInt() #1 {main} diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 908dade6f9368..d3d27cda22099 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -1196,29 +1196,11 @@ zend_string *zend_type_to_string_resolved(zend_type type, zend_class_entry *scop uint32_t type_mask = ZEND_TYPE_PURE_MASK(type); bool has_name = ZEND_TYPE_HAS_NAME(type); - /* BC for iterable type as a single type */ - if (UNEXPECTED(ZEND_TYPE_IS_ITERABLE_FALLBACK(type))) { - str = add_type_string(str, ZSTR_KNOWN(ZEND_STR_ITERABLE), /* is_intersection */ false); - /* Remove array bit */ - type_mask &= ~MAY_BE_ARRAY; - /* If it has a type name it must be Traversable, ignore it */ - if (has_name) { - has_name = false; - } - } - if (ZEND_TYPE_HAS_LIST(type)) { zend_type *list_type; bool is_intersection = ZEND_TYPE_IS_INTERSECTION(type); ZEND_TYPE_LIST_FOREACH(ZEND_TYPE_LIST(type), list_type) { zend_string *name = ZEND_TYPE_NAME(*list_type); - /* BC for iterable type in a union type */ - if (UNEXPECTED(ZEND_TYPE_IS_ITERABLE_FALLBACK(*list_type) && zend_string_equals(name, ZSTR_KNOWN(ZEND_STR_TRAVERSABLE)))) { - /* Remove array bit */ - type_mask &= ~MAY_BE_ARRAY; - str = add_type_string(str, ZSTR_KNOWN(ZEND_STR_ITERABLE), /* is_intersection */ false); - continue; - } zend_string *resolved = resolve_class_name(name, scope); str = add_type_string(str, resolved, is_intersection); zend_string_release(resolved); diff --git a/Zend/zend_types.h b/Zend/zend_types.h index ad444b2b4e528..908a2c769a909 100644 --- a/Zend/zend_types.h +++ b/Zend/zend_types.h @@ -268,7 +268,7 @@ typedef struct { #define ZEND_TYPE_INIT_CODE(code, allow_null, extra_flags) \ ZEND_TYPE_INIT_MASK(((code) == _IS_BOOL ? MAY_BE_BOOL : ( (code) == IS_ITERABLE ? _ZEND_TYPE_ITERABLE_BIT : ((code) == IS_MIXED ? MAY_BE_ANY : (1 << (code))))) \ - | ((allow_null) ? _ZEND_TYPE_NULLABLE_BIT : 0) | (extra_flags)) \ + | ((allow_null) ? _ZEND_TYPE_NULLABLE_BIT : 0) | (extra_flags)) #define ZEND_TYPE_INIT_PTR(ptr, type_kind, allow_null, extra_flags) \ { (void *) (ptr), \ diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index 8091dcbf429a6..b55f55f4bbbdd 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -3087,7 +3087,6 @@ ZEND_METHOD(ReflectionUnionType, getTypes) reflection_object *intern; type_reference *param; uint32_t type_mask; - bool has_iterable = false; if (zend_parse_parameters_none() == FAILURE) { RETURN_THROWS(); @@ -3098,10 +3097,6 @@ ZEND_METHOD(ReflectionUnionType, getTypes) if (ZEND_TYPE_HAS_LIST(param->type)) { zend_type *list_type; ZEND_TYPE_LIST_FOREACH(ZEND_TYPE_LIST(param->type), list_type) { - /* BC for iterable type */ - if (UNEXPECTED(ZEND_TYPE_IS_ITERABLE_FALLBACK(*list_type))) { - has_iterable = true; - } append_type(return_value, *list_type); } ZEND_TYPE_LIST_FOREACH_END(); } else if (ZEND_TYPE_HAS_NAME(param->type)) { @@ -3121,7 +3116,7 @@ ZEND_METHOD(ReflectionUnionType, getTypes) if (type_mask & MAY_BE_OBJECT) { append_type_mask(return_value, MAY_BE_OBJECT); } - if ((type_mask & MAY_BE_ARRAY) && !has_iterable) { + if ((type_mask & MAY_BE_ARRAY)) { append_type_mask(return_value, MAY_BE_ARRAY); } if (type_mask & MAY_BE_STRING) { diff --git a/ext/reflection/tests/ReflectionType_001.phpt b/ext/reflection/tests/ReflectionType_001.phpt index d0f327d0466ff..b4baf5355c038 100644 --- a/ext/reflection/tests/ReflectionType_001.phpt +++ b/ext/reflection/tests/ReflectionType_001.phpt @@ -80,7 +80,6 @@ class PropTypeTest { public int $int; public string $string; public array $arr; - public iterable $iterable; public stdClass $std; public OtherThing $other; public $mixed; @@ -216,7 +215,6 @@ string(4) "Test" public int $int; public string $string; public array $arr; -public iterable $iterable; public stdClass $std; public OtherThing $other; public $mixed; diff --git a/ext/reflection/tests/ReflectionType_possible_types.phpt b/ext/reflection/tests/ReflectionType_possible_types.phpt index dd6d39300b590..9162b71df98df 100644 --- a/ext/reflection/tests/ReflectionType_possible_types.phpt +++ b/ext/reflection/tests/ReflectionType_possible_types.phpt @@ -11,7 +11,6 @@ $functions = [ function(): bool {}, function(): array {}, function(): callable {}, - function(): iterable {}, function(): null {}, function(): false {}, function(): StdClass {} @@ -31,7 +30,6 @@ string(6) "string" string(4) "bool" string(5) "array" string(8) "callable" -string(8) "iterable" string(4) "null" string(5) "false" string(8) "StdClass" diff --git a/ext/reflection/tests/bug72661.phpt b/ext/reflection/tests/bug72661.phpt index b1cb764beb62a..b07db2f37b582 100644 --- a/ext/reflection/tests/bug72661.phpt +++ b/ext/reflection/tests/bug72661.phpt @@ -7,4 +7,4 @@ function test(iterable $arg) { } var_dump((string)(new ReflectionParameter("test", 0))->getType()); ?> --EXPECT-- -string(8) "iterable" +string(17) "Traversable|array" diff --git a/ext/reflection/tests/iterable_Reflection.phpt b/ext/reflection/tests/iterable_Reflection.phpt new file mode 100644 index 0000000000000..2f6b675cf2baa --- /dev/null +++ b/ext/reflection/tests/iterable_Reflection.phpt @@ -0,0 +1,33 @@ +--TEST-- +iterable Type in Reflection +--FILE-- +getReturnType(); + var_dump($returnType->getName()); +} + + +class PropIterableTypeTest { + public iterable $iterable; +} + +$reflector = new ReflectionClass(PropIterableTypeTest::class); + +foreach ($reflector->getProperties() as $name => $property) { + if ($property->hasType()) { + printf("public %s $%s;\n", + $property->getType()->getName(), $property->getName()); + } else printf("public $%s;\n", $property->getName()); +} + +?> +--EXPECT-- +string(17) "Traversable|array" +public Traversable|array $iterable; diff --git a/ext/reflection/tests/union_types.phpt b/ext/reflection/tests/union_types.phpt index a3ac53b54ab29..e670567712f3b 100644 --- a/ext/reflection/tests/union_types.phpt +++ b/ext/reflection/tests/union_types.phpt @@ -75,13 +75,16 @@ Allows null: true Name: null String: null Allows Null: true -Type X|iterable|bool: +Type X|Traversable|array|bool: Allows null: false Name: X String: X Allows Null: false - Name: iterable - String: iterable + Name: Traversable + String: Traversable + Allows Null: false + Name: array + String: array Allows Null: false Name: bool String: bool From 569ca2c464572803388ed9b8053a2f478f41f6e3 Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Sat, 23 Apr 2022 13:08:56 +0100 Subject: [PATCH 15/28] Remove shim for iterable BC --- Zend/zend_compile.c | 6 ++-- ext/reflection/php_reflection.c | 4 ++- ext/reflection/tests/iterable_Reflection.phpt | 32 ++++++++++--------- 3 files changed, 23 insertions(+), 19 deletions(-) diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index d3d27cda22099..9e38f13130b7b 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -1193,8 +1193,6 @@ static zend_string *resolve_class_name(zend_string *name, zend_class_entry *scop zend_string *zend_type_to_string_resolved(zend_type type, zend_class_entry *scope) { zend_string *str = NULL; - uint32_t type_mask = ZEND_TYPE_PURE_MASK(type); - bool has_name = ZEND_TYPE_HAS_NAME(type); if (ZEND_TYPE_HAS_LIST(type)) { zend_type *list_type; @@ -1205,10 +1203,12 @@ zend_string *zend_type_to_string_resolved(zend_type type, zend_class_entry *scop str = add_type_string(str, resolved, is_intersection); zend_string_release(resolved); } ZEND_TYPE_LIST_FOREACH_END(); - } else if (has_name) { + } else if (ZEND_TYPE_HAS_NAME(type)) { str = resolve_class_name(ZEND_TYPE_NAME(type), scope); } + uint32_t type_mask = ZEND_TYPE_PURE_MASK(type); + if (type_mask == MAY_BE_ANY) { str = add_type_string(str, ZSTR_KNOWN(ZEND_STR_MIXED), /* is_intersection */ false); diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index b55f55f4bbbdd..be12712c2abb0 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -1330,7 +1330,7 @@ typedef enum { } reflection_type_kind; /* For backwards compatibility reasons, we need to return T|null style unions - * and transformation from iterable to Traversable|array + * ~~and transformation from iterable to Traversable|array~~ * as a ReflectionNamedType. Here we determine what counts as a union type and * what doesn't. */ static reflection_type_kind get_type_kind(zend_type type) { @@ -1346,9 +1346,11 @@ static reflection_type_kind get_type_kind(zend_type type) { if (ZEND_TYPE_IS_COMPLEX(type)) { /* BC support for 'iterable' type */ + /* if (UNEXPECTED(ZEND_TYPE_IS_ITERABLE_FALLBACK(type))) { return NAMED_TYPE; } + */ if (type_mask_without_null != 0) { return UNION_TYPE; } diff --git a/ext/reflection/tests/iterable_Reflection.phpt b/ext/reflection/tests/iterable_Reflection.phpt index 2f6b675cf2baa..9a67481121b84 100644 --- a/ext/reflection/tests/iterable_Reflection.phpt +++ b/ext/reflection/tests/iterable_Reflection.phpt @@ -3,31 +3,33 @@ iterable Type in Reflection --FILE-- getReturnType(); - var_dump($returnType->getName()); +$reflectionFunc = new ReflectionFunction($function); +$returnType = $reflectionFunc->getReturnType(); +var_dump($returnType::class); +foreach ($returnType->getTypes() as $type) { + var_dump($type->getName()); } - class PropIterableTypeTest { public iterable $iterable; } $reflector = new ReflectionClass(PropIterableTypeTest::class); -foreach ($reflector->getProperties() as $name => $property) { - if ($property->hasType()) { - printf("public %s $%s;\n", - $property->getType()->getName(), $property->getName()); - } else printf("public $%s;\n", $property->getName()); +[$property] = $reflector->getProperties(); +$iterableType = $property->getType(); +var_dump($iterableType::class); +foreach ($iterableType->getTypes() as $type) { + var_dump($type->getName()); } ?> --EXPECT-- -string(17) "Traversable|array" -public Traversable|array $iterable; +string(19) "ReflectionUnionType" +string(11) "Traversable" +string(5) "array" +string(19) "ReflectionUnionType" +string(11) "Traversable" +string(5) "array" From 39b2258240a84952ef927b7a305ec477ca58b8e7 Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Sat, 23 Apr 2022 13:37:35 +0100 Subject: [PATCH 16/28] Make invalid types in intersection more robust --- .../invalid_types/invalid_iterable_type.phpt | 2 +- Zend/zend_compile.c | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/Zend/tests/type_declarations/intersection_types/invalid_types/invalid_iterable_type.phpt b/Zend/tests/type_declarations/intersection_types/invalid_types/invalid_iterable_type.phpt index fc4ee2d5607d0..3fd321d394ba4 100644 --- a/Zend/tests/type_declarations/intersection_types/invalid_types/invalid_iterable_type.phpt +++ b/Zend/tests/type_declarations/intersection_types/invalid_types/invalid_iterable_type.phpt @@ -7,4 +7,4 @@ function foo(): iterable&Iterator {} ?> --EXPECTF-- -Fatal error: Type iterable cannot be part of an intersection type in %s on line %d +Fatal error: Type Traversable|array cannot be part of an intersection type in %s on line %d diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 9e38f13130b7b..afb20c2b48565 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -6288,11 +6288,15 @@ static zend_type zend_compile_typename( zend_ast *type_ast = list->child[i]; zend_type single_type = zend_compile_single_typename(type_ast); - /* An intersection of standard types cannot exist so invalidate it */ - /* Check for iterable early */ - if (ZEND_TYPE_IS_ITERABLE_FALLBACK(single_type)) { - zend_error_noreturn(E_COMPILE_ERROR, "Type iterable cannot be part of an intersection type"); + /* An intersection of union types cannot exist so invalidate it + * Currently only can happen with iterable getting canonicalized to Traversable|array */ + if (ZEND_TYPE_IS_UNION(single_type)) { + zend_string *standard_type_str = zend_type_to_string(single_type); + zend_error_noreturn(E_COMPILE_ERROR, + "Type %s cannot be part of an intersection type", ZSTR_VAL(standard_type_str)); + zend_string_release_ex(standard_type_str, false); } + /* An intersection of standard types cannot exist so invalidate it */ if (ZEND_TYPE_IS_ONLY_MASK(single_type)) { zend_string *standard_type_str = zend_type_to_string(single_type); zend_error_noreturn(E_COMPILE_ERROR, From 307b663de1e8c6a10b9885a5f21d0320755365cf Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Sat, 23 Apr 2022 13:49:32 +0100 Subject: [PATCH 17/28] Fix opcache test --- ext/opcache/tests/iterable_type_optimization.phpt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/opcache/tests/iterable_type_optimization.phpt b/ext/opcache/tests/iterable_type_optimization.phpt index 277df8f374c26..340fcdea22811 100644 --- a/ext/opcache/tests/iterable_type_optimization.phpt +++ b/ext/opcache/tests/iterable_type_optimization.phpt @@ -12,7 +12,7 @@ test(new stdClass); ?> --EXPECTF-- -Fatal error: Uncaught TypeError: test(): Return value must be of type iterable, stdClass returned in %s:%d +Fatal error: Uncaught TypeError: test(): Return value must be of type Traversable|array, stdClass returned in %s:%d Stack trace: #0 %s(%d): test(Object(stdClass)) #1 {main} From 37b7141fe8299db84d93d1d74ba4667a8bd5cc92 Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Wed, 27 Apr 2022 22:25:30 +0100 Subject: [PATCH 18/28] Check for legacy iterable arg_info during function registration This segfaults and I don't know why --- Zend/zend_API.c | 20 ++++++++++-- Zend/zend_compile.c | 2 +- ext/zend_test/test.c | 26 ++++++++++++++++ ext/zend_test/tests/attribute_arguments.phpt | 3 ++ .../tests/attribute_hash_table_leak.phpt | 3 ++ ext/zend_test/tests/fiber_test_01.phpt | 3 ++ ext/zend_test/tests/fiber_test_02.phpt | 3 ++ ext/zend_test/tests/fiber_test_03.phpt | 3 ++ ext/zend_test/tests/fiber_test_04.phpt | 3 ++ ext/zend_test/tests/fiber_test_05.phpt | 3 ++ ext/zend_test/tests/fiber_test_06.phpt | 3 ++ ext/zend_test/tests/fiber_test_07.phpt | 3 ++ ext/zend_test/tests/gen_stub_test_01.phpt | 3 ++ .../tests/observer_backtrace_01.phpt | 3 ++ ext/zend_test/tests/observer_basic_01.phpt | 3 ++ ext/zend_test/tests/observer_basic_02.phpt | 3 ++ ext/zend_test/tests/observer_basic_03.phpt | 3 ++ ext/zend_test/tests/observer_basic_04.phpt | 3 ++ ext/zend_test/tests/observer_basic_05.phpt | 3 ++ ext/zend_test/tests/observer_bug81430_1.phpt | 3 ++ ext/zend_test/tests/observer_bug81430_2.phpt | 3 ++ ext/zend_test/tests/observer_bug81435.phpt | 3 ++ .../tests/observer_call_user_func_01.phpt | 3 ++ .../tests/observer_call_user_func_02.phpt | 3 ++ .../tests/observer_call_user_func_03.phpt | 3 ++ .../tests/observer_call_user_func_04.phpt | 3 ++ ext/zend_test/tests/observer_closure_01.phpt | 3 ++ ext/zend_test/tests/observer_closure_02.phpt | 3 ++ ext/zend_test/tests/observer_error_01.phpt | 3 ++ ext/zend_test/tests/observer_error_02.phpt | 3 ++ ext/zend_test/tests/observer_error_03.phpt | 3 ++ ext/zend_test/tests/observer_error_04.phpt | 3 ++ ext/zend_test/tests/observer_error_05.phpt | 3 ++ ext/zend_test/tests/observer_eval_01.phpt | 3 ++ .../tests/observer_exception_01.phpt | 3 ++ ext/zend_test/tests/observer_fiber_01.phpt | 3 ++ ext/zend_test/tests/observer_fiber_02.phpt | 3 ++ ext/zend_test/tests/observer_fiber_03.phpt | 3 ++ ext/zend_test/tests/observer_fiber_04.phpt | 3 ++ ext/zend_test/tests/observer_fiber_05.phpt | 3 ++ ext/zend_test/tests/observer_fiber_06.phpt | 3 ++ .../tests/observer_generator_01.phpt | 3 ++ .../tests/observer_generator_02.phpt | 3 ++ .../tests/observer_generator_03.phpt | 3 ++ .../tests/observer_generator_04.phpt | 3 ++ .../tests/observer_generator_05.phpt | 3 ++ ext/zend_test/tests/observer_magic_01.phpt | 3 ++ ext/zend_test/tests/observer_opline_01.phpt | 3 ++ ext/zend_test/tests/observer_retval_01.phpt | 3 ++ ext/zend_test/tests/observer_retval_02.phpt | 3 ++ ext/zend_test/tests/observer_retval_03.phpt | 3 ++ ext/zend_test/tests/observer_retval_04.phpt | 3 ++ ext/zend_test/tests/observer_retval_05.phpt | 3 ++ ext/zend_test/tests/observer_retval_06.phpt | 3 ++ ext/zend_test/tests/observer_retval_07.phpt | 3 ++ .../tests/observer_retval_by_ref_01.phpt | 3 ++ .../tests/observer_retval_by_ref_02.phpt | 3 ++ .../tests/observer_retval_by_ref_03.phpt | 3 ++ ext/zend_test/tests/observer_shutdown_01.phpt | 3 ++ ext/zend_test/tests/observer_shutdown_02.phpt | 3 ++ ext/zend_test/tests/observer_types_01.phpt | 3 ++ .../tests/observer_zend_call_function_01.phpt | 3 ++ .../tests/optimizer_register_pass.phpt | 3 ++ ext/zend_test/tests/zend_legacy_iterable.phpt | 31 +++++++++++++++++++ .../tests/zend_test_compile_string.phpt | 3 ++ ext/zend_test/tests/zend_weakmap.phpt | 5 ++- 66 files changed, 263 insertions(+), 4 deletions(-) create mode 100644 ext/zend_test/tests/zend_legacy_iterable.phpt diff --git a/Zend/zend_API.c b/Zend/zend_API.c index 9e903f16ce1ef..9f7078fb35c5a 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -2784,6 +2784,7 @@ ZEND_API zend_result zend_register_functions(zend_class_entry *scope, const zend num_args++; } + bool rebuild_arginfo = false; /* If types of arguments have to be checked */ if (reg_function->common.arg_info && num_args) { uint32_t i; @@ -2791,6 +2792,11 @@ ZEND_API zend_result zend_register_functions(zend_class_entry *scope, const zend zend_internal_arg_info *arg_info = ®_function->internal_function.arg_info[i]; ZEND_ASSERT(arg_info->name && "Parameter must have a name"); if (ZEND_TYPE_IS_SET(arg_info->type)) { + if (ZEND_TYPE_IS_ITERABLE_FALLBACK(arg_info->type)) { + zend_error(E_CORE_WARNING, "iterable type is now a compile time alias for array|Traversable," + " regenerate the argument info via the php-src gen_stub build script"); + rebuild_arginfo = true; + } reg_function->common.fn_flags |= ZEND_ACC_HAS_TYPE_HINTS; } #if ZEND_DEBUG @@ -2807,13 +2813,17 @@ ZEND_API zend_result zend_register_functions(zend_class_entry *scope, const zend if (reg_function->common.arg_info && (reg_function->common.fn_flags & (ZEND_ACC_HAS_RETURN_TYPE|ZEND_ACC_HAS_TYPE_HINTS))) { + /* Treat return type as an extra argument */ + num_args++; + rebuild_arginfo = true; + } + + if (rebuild_arginfo) { /* convert "const char*" class type names into "zend_string*" */ uint32_t i; zend_arg_info *arg_info = reg_function->common.arg_info - 1; zend_arg_info *new_arg_info; - /* Treat return type as an extra argument */ - num_args++; new_arg_info = malloc(sizeof(zend_arg_info) * num_args); memcpy(new_arg_info, arg_info, sizeof(zend_arg_info) * num_args); reg_function->common.arg_info = new_arg_info + 1; @@ -2856,6 +2866,12 @@ ZEND_API zend_result zend_register_functions(zend_class_entry *scope, const zend } } } + if (ZEND_TYPE_IS_ITERABLE_FALLBACK(new_arg_info[i].type)) { + zend_type legacy_iterable = ZEND_TYPE_INIT_CLASS_CONST_MASK(ZSTR_KNOWN(ZEND_STR_TRAVERSABLE), + (new_arg_info[i].type.type_mask|_ZEND_TYPE_UNION_BIT|MAY_BE_ARRAY)); + memcpy(&new_arg_info[i].type, &legacy_iterable, sizeof(zend_type)); + //return FAILURE; + } } } diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index afb20c2b48565..66fc39bd175d6 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -6147,8 +6147,8 @@ static zend_type zend_compile_single_typename(zend_ast *ast) /* Transform iterable into a type union alias */ if (type_code == IS_ITERABLE) { zend_type iterable = (zend_type) ZEND_TYPE_INIT_CLASS(ZSTR_KNOWN(ZEND_STR_TRAVERSABLE), 0, 0); - ZEND_TYPE_FULL_MASK(iterable) |= _ZEND_TYPE_NAME_BIT; ZEND_TYPE_FULL_MASK(iterable) |= MAY_BE_ARRAY; + // TODO Use this instead? ZEND_TYPE_INIT_CLASS_CONST_MASK(ZSTR_KNOWN(ZEND_STR_TRAVERSABLE), MAY_BE_ARRAY); /* Set iterable bit for BC compat during Reflection and string representation of type */ ZEND_TYPE_FULL_MASK(iterable) |= _ZEND_TYPE_ITERABLE_BIT; /* Inform that the type list is a union type */ diff --git a/ext/zend_test/test.c b/ext/zend_test/test.c index 37bbc4547f8af..3d56622c6b5b3 100644 --- a/ext/zend_test/test.c +++ b/ext/zend_test/test.c @@ -314,6 +314,29 @@ static ZEND_FUNCTION(zend_iterable) ZEND_PARSE_PARAMETERS_END(); } +static ZEND_FUNCTION(zend_iterable_legacy) +{ + zval *arg1, *arg2; + + ZEND_PARSE_PARAMETERS_START(1, 2) + Z_PARAM_ITERABLE(arg1) + Z_PARAM_OPTIONAL + Z_PARAM_ITERABLE_OR_NULL(arg2) + ZEND_PARSE_PARAMETERS_END(); + + RETURN_COPY(arg1); +} + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_zend_iterable_legacy, 0, 1, IS_ITERABLE, 0) + ZEND_ARG_TYPE_INFO(0, arg1, IS_ITERABLE, 0) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, arg2, IS_ITERABLE, 1, "null") +ZEND_END_ARG_INFO() + +static const zend_function_entry ext_function_legacy[] = { + ZEND_FE(zend_iterable_legacy, arginfo_zend_iterable_legacy) + ZEND_FE_END +}; + /* Call a method on a class or object using zend_call_method() */ static ZEND_FUNCTION(zend_call_method) { @@ -628,6 +651,9 @@ PHP_MINIT_FUNCTION(zend_test) zend_test_string_enum = register_class_ZendTestStringEnum(); zend_test_int_enum = register_class_ZendTestIntEnum(); + /* Register legacy iterable function */ + zend_register_functions(NULL, ext_function_legacy, NULL, EG(current_module)->type); + // Loading via dl() not supported with the observer API if (type != MODULE_TEMPORARY) { REGISTER_INI_ENTRIES(); diff --git a/ext/zend_test/tests/attribute_arguments.phpt b/ext/zend_test/tests/attribute_arguments.phpt index e1ec8a89d9a00..9780a960217dd 100644 --- a/ext/zend_test/tests/attribute_arguments.phpt +++ b/ext/zend_test/tests/attribute_arguments.phpt @@ -86,6 +86,9 @@ var_dump($attribute->newInstance()); ?> --EXPECTF-- +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 array(1) { [0]=> string(6) "value1" diff --git a/ext/zend_test/tests/attribute_hash_table_leak.phpt b/ext/zend_test/tests/attribute_hash_table_leak.phpt index 10c786393589e..9bbb66552b000 100644 --- a/ext/zend_test/tests/attribute_hash_table_leak.phpt +++ b/ext/zend_test/tests/attribute_hash_table_leak.phpt @@ -55,6 +55,9 @@ var_dump($o->override("foo")); ?> --EXPECT-- +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 int(1) int(2) int(3) diff --git a/ext/zend_test/tests/fiber_test_01.phpt b/ext/zend_test/tests/fiber_test_01.phpt index d0ebcbdee5a96..c9716b61d071f 100644 --- a/ext/zend_test/tests/fiber_test_01.phpt +++ b/ext/zend_test/tests/fiber_test_01.phpt @@ -21,6 +21,9 @@ var_dump($fiber->getReturn()); // int(1) ?> --EXPECT-- +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 int(123) int(246) NULL diff --git a/ext/zend_test/tests/fiber_test_02.phpt b/ext/zend_test/tests/fiber_test_02.phpt index 23cc9b0d68195..64b5479665f5a 100644 --- a/ext/zend_test/tests/fiber_test_02.phpt +++ b/ext/zend_test/tests/fiber_test_02.phpt @@ -17,6 +17,9 @@ var_dump($test->resume(2)); // NULL ?> --EXPECT-- +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 int(1) int(2) NULL diff --git a/ext/zend_test/tests/fiber_test_03.phpt b/ext/zend_test/tests/fiber_test_03.phpt index 3641608ae5971..bda9a032c613e 100644 --- a/ext/zend_test/tests/fiber_test_03.phpt +++ b/ext/zend_test/tests/fiber_test_03.phpt @@ -22,6 +22,9 @@ $value = $fiber->throw(new Exception('test')); ?> --EXPECTF-- +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 int(1) int(2) int(3) diff --git a/ext/zend_test/tests/fiber_test_04.phpt b/ext/zend_test/tests/fiber_test_04.phpt index 4b7cdd3398fc6..6cf58259bc5f4 100644 --- a/ext/zend_test/tests/fiber_test_04.phpt +++ b/ext/zend_test/tests/fiber_test_04.phpt @@ -30,6 +30,9 @@ var_dump($fiber->getReturn()); // int(-1) ?> --EXPECT-- +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 int(1) int(2) int(3) diff --git a/ext/zend_test/tests/fiber_test_05.phpt b/ext/zend_test/tests/fiber_test_05.phpt index adba08c39652f..2f19241e6f755 100644 --- a/ext/zend_test/tests/fiber_test_05.phpt +++ b/ext/zend_test/tests/fiber_test_05.phpt @@ -28,6 +28,9 @@ $value = $test->resume(2 * $value); ?> --EXPECT-- +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 int(1) int(2) int(3) diff --git a/ext/zend_test/tests/fiber_test_06.phpt b/ext/zend_test/tests/fiber_test_06.phpt index 67b9067023cb3..ee0fe3f792803 100644 --- a/ext/zend_test/tests/fiber_test_06.phpt +++ b/ext/zend_test/tests/fiber_test_06.phpt @@ -29,6 +29,9 @@ var_dump($fiber->resume('2')); // NULL ?> --EXPECT-- +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 int(10) int(1) string(1) "1" diff --git a/ext/zend_test/tests/fiber_test_07.phpt b/ext/zend_test/tests/fiber_test_07.phpt index 0c5c08234cda0..c4dc60e550001 100644 --- a/ext/zend_test/tests/fiber_test_07.phpt +++ b/ext/zend_test/tests/fiber_test_07.phpt @@ -17,5 +17,8 @@ var_dump($fiber->start()); ?> --EXPECT-- +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 int(1) NULL diff --git a/ext/zend_test/tests/gen_stub_test_01.phpt b/ext/zend_test/tests/gen_stub_test_01.phpt index 8b13cbaa034b3..4e2ebe8961660 100644 --- a/ext/zend_test/tests/gen_stub_test_01.phpt +++ b/ext/zend_test/tests/gen_stub_test_01.phpt @@ -11,6 +11,9 @@ $foo->foo = new \ZendTestNS2\ZendSubNS\Foo(); var_dump($foo); ?> --EXPECTF-- +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 object(ZendTestNS2\Foo)#%d (%d) { ["foo"]=> uninitialized(ZendTestNS2\ZendSubNS\Foo) diff --git a/ext/zend_test/tests/observer_backtrace_01.phpt b/ext/zend_test/tests/observer_backtrace_01.phpt index 875a04c395f36..d34af63354372 100644 --- a/ext/zend_test/tests/observer_backtrace_01.phpt +++ b/ext/zend_test/tests/observer_backtrace_01.phpt @@ -37,6 +37,9 @@ function foo() var_dump(foo()); ?> --EXPECTF-- +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_basic_02.phpt b/ext/zend_test/tests/observer_basic_02.phpt index adbdc7818151f..b3a5b9f24e1dd 100644 --- a/ext/zend_test/tests/observer_basic_02.phpt +++ b/ext/zend_test/tests/observer_basic_02.phpt @@ -30,6 +30,9 @@ $test->foo(); echo 'DONE' . PHP_EOL; ?> --EXPECTF-- +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_basic_03.phpt b/ext/zend_test/tests/observer_basic_03.phpt index f98390a0c986a..e5fe269c3e766 100644 --- a/ext/zend_test/tests/observer_basic_03.phpt +++ b/ext/zend_test/tests/observer_basic_03.phpt @@ -17,6 +17,9 @@ include __DIR__ . '/observer.inc'; foo(); ?> --EXPECTF-- +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_basic_04.phpt b/ext/zend_test/tests/observer_basic_04.phpt index 1b55f6da3d272..16cc82ddb56aa 100644 --- a/ext/zend_test/tests/observer_basic_04.phpt +++ b/ext/zend_test/tests/observer_basic_04.phpt @@ -17,6 +17,9 @@ include __DIR__ . '/observer.inc'; foo(); ?> --EXPECTF-- +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_basic_05.phpt b/ext/zend_test/tests/observer_basic_05.phpt index 1891cd87ae49b..3dcf0f2bfe70a 100644 --- a/ext/zend_test/tests/observer_basic_05.phpt +++ b/ext/zend_test/tests/observer_basic_05.phpt @@ -17,6 +17,9 @@ include __DIR__ . '/observer.inc'; foo(); ?> --EXPECTF-- +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_bug81430_1.phpt b/ext/zend_test/tests/observer_bug81430_1.phpt index cac53ef70cbbb..7d1a36d9fc134 100644 --- a/ext/zend_test/tests/observer_bug81430_1.phpt +++ b/ext/zend_test/tests/observer_bug81430_1.phpt @@ -23,6 +23,9 @@ $r = new \ReflectionFunction("B"); call_user_func([$r->getAttributes(A::class)[0], 'newInstance']); ?> --EXPECTF-- +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_bug81430_2.phpt b/ext/zend_test/tests/observer_bug81430_2.phpt index 4d56248a80f34..892436e028439 100644 --- a/ext/zend_test/tests/observer_bug81430_2.phpt +++ b/ext/zend_test/tests/observer_bug81430_2.phpt @@ -23,6 +23,9 @@ $r = new \ReflectionFunction("B"); call_user_func([$r->getAttributes(A::class)[0], 'newInstance']); ?> --EXPECTF-- +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_bug81435.phpt b/ext/zend_test/tests/observer_bug81435.phpt index 2b78c50993160..01bdfeeb154fb 100644 --- a/ext/zend_test/tests/observer_bug81435.phpt +++ b/ext/zend_test/tests/observer_bug81435.phpt @@ -33,6 +33,9 @@ a(); ?> --EXPECTF-- +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_call_user_func_01.phpt b/ext/zend_test/tests/observer_call_user_func_01.phpt index f4a25a0372310..9bd825a811ff3 100644 --- a/ext/zend_test/tests/observer_call_user_func_01.phpt +++ b/ext/zend_test/tests/observer_call_user_func_01.phpt @@ -27,6 +27,9 @@ namespace { } ?> --EXPECTF-- +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_call_user_func_02.phpt b/ext/zend_test/tests/observer_call_user_func_02.phpt index 30a4b08f3fc03..30d55c17cf744 100644 --- a/ext/zend_test/tests/observer_call_user_func_02.phpt +++ b/ext/zend_test/tests/observer_call_user_func_02.phpt @@ -27,6 +27,9 @@ namespace { } ?> --EXPECTF-- +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_call_user_func_03.phpt b/ext/zend_test/tests/observer_call_user_func_03.phpt index 827730111f65b..ae28f93bd5d40 100644 --- a/ext/zend_test/tests/observer_call_user_func_03.phpt +++ b/ext/zend_test/tests/observer_call_user_func_03.phpt @@ -26,6 +26,9 @@ namespace Test { } ?> --EXPECTF-- +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_call_user_func_04.phpt b/ext/zend_test/tests/observer_call_user_func_04.phpt index 7f516002aeff7..90767d3b79698 100644 --- a/ext/zend_test/tests/observer_call_user_func_04.phpt +++ b/ext/zend_test/tests/observer_call_user_func_04.phpt @@ -26,6 +26,9 @@ namespace Test { } ?> --EXPECTF-- +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_closure_01.phpt b/ext/zend_test/tests/observer_closure_01.phpt index c10b170337bf4..1208043453d7c 100644 --- a/ext/zend_test/tests/observer_closure_01.phpt +++ b/ext/zend_test/tests/observer_closure_01.phpt @@ -23,6 +23,9 @@ $foo($bar); echo 'DONE' . PHP_EOL; ?> --EXPECTF-- +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_closure_02.phpt b/ext/zend_test/tests/observer_closure_02.phpt index e9724405647cd..0fe834a07cd42 100644 --- a/ext/zend_test/tests/observer_closure_02.phpt +++ b/ext/zend_test/tests/observer_closure_02.phpt @@ -22,6 +22,9 @@ $closure(); echo 'DONE' . PHP_EOL; ?> --EXPECTF-- +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_error_01.phpt b/ext/zend_test/tests/observer_error_01.phpt index 534e484c8a04c..dbec38aa250c9 100644 --- a/ext/zend_test/tests/observer_error_01.phpt +++ b/ext/zend_test/tests/observer_error_01.phpt @@ -19,6 +19,9 @@ foo(); echo 'You should not see this.'; ?> --EXPECTF-- +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_error_02.phpt b/ext/zend_test/tests/observer_error_02.phpt index 426c345e75045..a7a0dfce933c8 100644 --- a/ext/zend_test/tests/observer_error_02.phpt +++ b/ext/zend_test/tests/observer_error_02.phpt @@ -18,6 +18,9 @@ foo(); echo 'You should not see this.'; ?> --EXPECTF-- +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_error_03.phpt b/ext/zend_test/tests/observer_error_03.phpt index b9f5ae75cc0d9..13f80c49d2a9f 100644 --- a/ext/zend_test/tests/observer_error_03.phpt +++ b/ext/zend_test/tests/observer_error_03.phpt @@ -24,6 +24,9 @@ main(); echo 'Done.' . PHP_EOL; ?> --EXPECTF-- +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_error_04.phpt b/ext/zend_test/tests/observer_error_04.phpt index da0bc4b6c94a2..f67eaa915fadb 100644 --- a/ext/zend_test/tests/observer_error_04.phpt +++ b/ext/zend_test/tests/observer_error_04.phpt @@ -30,6 +30,9 @@ try { echo 'Done.' . PHP_EOL; ?> --EXPECTF-- +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_error_05.phpt b/ext/zend_test/tests/observer_error_05.phpt index 58a34096604b5..dcc9842724422 100644 --- a/ext/zend_test/tests/observer_error_05.phpt +++ b/ext/zend_test/tests/observer_error_05.phpt @@ -22,6 +22,9 @@ foo(); echo 'You should not see this.'; ?> --EXPECTF-- +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_eval_01.phpt b/ext/zend_test/tests/observer_eval_01.phpt index 7f9ff53acba11..0d0a3c05e25d8 100644 --- a/ext/zend_test/tests/observer_eval_01.phpt +++ b/ext/zend_test/tests/observer_eval_01.phpt @@ -11,6 +11,9 @@ echo eval("return 'Foo eval' . PHP_EOL;"); echo 'DONE' . PHP_EOL; ?> --EXPECTF-- +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_exception_01.phpt b/ext/zend_test/tests/observer_exception_01.phpt index 19e90e0ac62cc..9f3fc783cc08a 100644 --- a/ext/zend_test/tests/observer_exception_01.phpt +++ b/ext/zend_test/tests/observer_exception_01.phpt @@ -23,6 +23,9 @@ foo(); echo 'You should not see this' . PHP_EOL; ?> --EXPECTF-- +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_fiber_01.phpt b/ext/zend_test/tests/observer_fiber_01.phpt index bd65731016093..65669767b5b2a 100644 --- a/ext/zend_test/tests/observer_fiber_01.phpt +++ b/ext/zend_test/tests/observer_fiber_01.phpt @@ -19,6 +19,9 @@ $fiber->resume(); ?> --EXPECTF-- +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_fiber_02.phpt b/ext/zend_test/tests/observer_fiber_02.phpt index 6e420ef0ea6c4..4977babcc33dc 100644 --- a/ext/zend_test/tests/observer_fiber_02.phpt +++ b/ext/zend_test/tests/observer_fiber_02.phpt @@ -16,6 +16,9 @@ $fiber->start(); ?> --EXPECTF-- +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_fiber_03.phpt b/ext/zend_test/tests/observer_fiber_03.phpt index 67699c25ae859..21a605000023c 100644 --- a/ext/zend_test/tests/observer_fiber_03.phpt +++ b/ext/zend_test/tests/observer_fiber_03.phpt @@ -39,6 +39,9 @@ $fiber->resume(); ?> --EXPECTF-- +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_fiber_04.phpt b/ext/zend_test/tests/observer_fiber_04.phpt index 3a72132f5b5e6..07661fc9ff249 100644 --- a/ext/zend_test/tests/observer_fiber_04.phpt +++ b/ext/zend_test/tests/observer_fiber_04.phpt @@ -26,6 +26,9 @@ $fiber->resume(); ?> --EXPECTF-- +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_fiber_05.phpt b/ext/zend_test/tests/observer_fiber_05.phpt index 87ba3a856cad2..06c9122963ea4 100644 --- a/ext/zend_test/tests/observer_fiber_05.phpt +++ b/ext/zend_test/tests/observer_fiber_05.phpt @@ -25,6 +25,9 @@ $fiber->resume(); ?> --EXPECTF-- +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_fiber_06.phpt b/ext/zend_test/tests/observer_fiber_06.phpt index 5a80a8efc1c5d..7d901b2c2b643 100644 --- a/ext/zend_test/tests/observer_fiber_06.phpt +++ b/ext/zend_test/tests/observer_fiber_06.phpt @@ -22,6 +22,9 @@ try { ?> --EXPECTF-- +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_generator_01.phpt b/ext/zend_test/tests/observer_generator_01.phpt index f7170aad3388c..19e85b7395214 100644 --- a/ext/zend_test/tests/observer_generator_01.phpt +++ b/ext/zend_test/tests/observer_generator_01.phpt @@ -26,6 +26,9 @@ function doSomething() { echo doSomething() . PHP_EOL; ?> --EXPECTF-- +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_generator_02.phpt b/ext/zend_test/tests/observer_generator_02.phpt index 289cfa1f954c8..a972ec7376f4f 100644 --- a/ext/zend_test/tests/observer_generator_02.phpt +++ b/ext/zend_test/tests/observer_generator_02.phpt @@ -28,6 +28,9 @@ function doSomething() { echo doSomething() . PHP_EOL; ?> --EXPECTF-- +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_generator_03.phpt b/ext/zend_test/tests/observer_generator_03.phpt index 9022cd3345605..f2d8a1b327f8f 100644 --- a/ext/zend_test/tests/observer_generator_03.phpt +++ b/ext/zend_test/tests/observer_generator_03.phpt @@ -33,6 +33,9 @@ function doSomething() { echo doSomething() . PHP_EOL; ?> --EXPECTF-- +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_generator_04.phpt b/ext/zend_test/tests/observer_generator_04.phpt index 46fb272162e43..19df6d2690ec8 100644 --- a/ext/zend_test/tests/observer_generator_04.phpt +++ b/ext/zend_test/tests/observer_generator_04.phpt @@ -33,6 +33,9 @@ function doSomething() { echo doSomething() . PHP_EOL; ?> --EXPECTF-- +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_generator_05.phpt b/ext/zend_test/tests/observer_generator_05.phpt index d106be2ba6abe..e5b3044a19508 100644 --- a/ext/zend_test/tests/observer_generator_05.phpt +++ b/ext/zend_test/tests/observer_generator_05.phpt @@ -26,6 +26,9 @@ function doSomething() { echo doSomething() . PHP_EOL; ?> --EXPECTF-- +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_magic_01.phpt b/ext/zend_test/tests/observer_magic_01.phpt index 0f89fba77f382..48af223ca7780 100644 --- a/ext/zend_test/tests/observer_magic_01.phpt +++ b/ext/zend_test/tests/observer_magic_01.phpt @@ -28,6 +28,9 @@ $test->bar(); echo 'DONE' . PHP_EOL; ?> --EXPECTF-- +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_opline_01.phpt b/ext/zend_test/tests/observer_opline_01.phpt index 35727349bb49c..2705da92dc792 100644 --- a/ext/zend_test/tests/observer_opline_01.phpt +++ b/ext/zend_test/tests/observer_opline_01.phpt @@ -20,6 +20,9 @@ echo array_sum([1,2,3]) . PHP_EOL; foo(); ?> --EXPECTF-- +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_retval_01.phpt b/ext/zend_test/tests/observer_retval_01.phpt index a63b0bd0efc87..c2c8c19705b2e 100644 --- a/ext/zend_test/tests/observer_retval_01.phpt +++ b/ext/zend_test/tests/observer_retval_01.phpt @@ -19,6 +19,9 @@ foo(); // Retval unused echo 'Done' . PHP_EOL; ?> --EXPECTF-- +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_retval_02.phpt b/ext/zend_test/tests/observer_retval_02.phpt index 73992aa58312a..3ad111ddcf10d 100644 --- a/ext/zend_test/tests/observer_retval_02.phpt +++ b/ext/zend_test/tests/observer_retval_02.phpt @@ -21,6 +21,9 @@ $gen->current(); echo 'Done' . PHP_EOL; ?> --EXPECTF-- +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_retval_03.phpt b/ext/zend_test/tests/observer_retval_03.phpt index 247c56480b0f0..7cfc67668121d 100644 --- a/ext/zend_test/tests/observer_retval_03.phpt +++ b/ext/zend_test/tests/observer_retval_03.phpt @@ -21,6 +21,9 @@ foo(); // Retval unused echo 'Done' . PHP_EOL; ?> --EXPECTF-- +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_retval_04.phpt b/ext/zend_test/tests/observer_retval_04.phpt index a08a5de378ed6..8fd163d3e00ba 100644 --- a/ext/zend_test/tests/observer_retval_04.phpt +++ b/ext/zend_test/tests/observer_retval_04.phpt @@ -31,6 +31,9 @@ bar('freed'); // Retval unused echo 'Done' . PHP_EOL; ?> --EXPECTF-- +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_retval_05.phpt b/ext/zend_test/tests/observer_retval_05.phpt index 7d05cb92986b0..b18b0e5136347 100644 --- a/ext/zend_test/tests/observer_retval_05.phpt +++ b/ext/zend_test/tests/observer_retval_05.phpt @@ -18,6 +18,9 @@ foo(); // Retval unused echo 'Done' . PHP_EOL; ?> --EXPECTF-- +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_retval_06.phpt b/ext/zend_test/tests/observer_retval_06.phpt index ffb41aac59818..6d6a0f6606743 100644 --- a/ext/zend_test/tests/observer_retval_06.phpt +++ b/ext/zend_test/tests/observer_retval_06.phpt @@ -19,6 +19,9 @@ foo(); // Retval unused echo 'Done' . PHP_EOL; ?> --EXPECTF-- +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_retval_07.phpt b/ext/zend_test/tests/observer_retval_07.phpt index 9c9c6246f587b..619b233394f65 100644 --- a/ext/zend_test/tests/observer_retval_07.phpt +++ b/ext/zend_test/tests/observer_retval_07.phpt @@ -23,6 +23,9 @@ foo(); // Retval unused echo 'Done' . PHP_EOL; ?> --EXPECTF-- +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_retval_by_ref_01.phpt b/ext/zend_test/tests/observer_retval_by_ref_01.phpt index 2a7b74de8a756..caee2ffe01a01 100644 --- a/ext/zend_test/tests/observer_retval_by_ref_01.phpt +++ b/ext/zend_test/tests/observer_retval_by_ref_01.phpt @@ -19,6 +19,9 @@ foo(); // Retval unused echo 'Done' . PHP_EOL; ?> --EXPECTF-- +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_retval_by_ref_02.phpt b/ext/zend_test/tests/observer_retval_by_ref_02.phpt index b28dc704e4d6a..00d75e4f0b00a 100644 --- a/ext/zend_test/tests/observer_retval_by_ref_02.phpt +++ b/ext/zend_test/tests/observer_retval_by_ref_02.phpt @@ -19,6 +19,9 @@ foo(); // Retval unused echo 'Done' . PHP_EOL; ?> --EXPECTF-- +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_retval_by_ref_03.phpt b/ext/zend_test/tests/observer_retval_by_ref_03.phpt index 9c4cd622e7da1..2c3a00e726488 100644 --- a/ext/zend_test/tests/observer_retval_by_ref_03.phpt +++ b/ext/zend_test/tests/observer_retval_by_ref_03.phpt @@ -23,6 +23,9 @@ foo(); // Retval unused echo 'Done' . PHP_EOL; ?> --EXPECTF-- +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_shutdown_01.phpt b/ext/zend_test/tests/observer_shutdown_01.phpt index 837d0f7f2b7d2..9ce8b62c017a7 100644 --- a/ext/zend_test/tests/observer_shutdown_01.phpt +++ b/ext/zend_test/tests/observer_shutdown_01.phpt @@ -24,6 +24,9 @@ function foo() { echo 'Done: ' . bar(40) . PHP_EOL; ?> --EXPECTF-- +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_shutdown_02.phpt b/ext/zend_test/tests/observer_shutdown_02.phpt index f3fbce36dfb8a..7425ecd83ccb0 100644 --- a/ext/zend_test/tests/observer_shutdown_02.phpt +++ b/ext/zend_test/tests/observer_shutdown_02.phpt @@ -30,6 +30,9 @@ $mc = new MyClass(); echo 'Done: ' . bar(40) . PHP_EOL; ?> --EXPECTF-- +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_types_01.phpt b/ext/zend_test/tests/observer_types_01.phpt index 7176ab32b494e..c35d5026f7a02 100644 --- a/ext/zend_test/tests/observer_types_01.phpt +++ b/ext/zend_test/tests/observer_types_01.phpt @@ -12,6 +12,9 @@ function foo(array $a) { return 1; } foo(42); ?> --EXPECTF-- +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_zend_call_function_01.phpt b/ext/zend_test/tests/observer_zend_call_function_01.phpt index e148c9b20bd09..b6c7f886425ad 100644 --- a/ext/zend_test/tests/observer_zend_call_function_01.phpt +++ b/ext/zend_test/tests/observer_zend_call_function_01.phpt @@ -18,6 +18,9 @@ var_dump(array_reduce($a, 'sum')); echo 'Done' . PHP_EOL; ?> --EXPECTF-- +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/optimizer_register_pass.phpt b/ext/zend_test/tests/optimizer_register_pass.phpt index 50499344c4709..fb1cee769466d 100644 --- a/ext/zend_test/tests/optimizer_register_pass.phpt +++ b/ext/zend_test/tests/optimizer_register_pass.phpt @@ -22,5 +22,8 @@ zend_test.register_passes=1 ?> --EXPECT-- +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 pass1 pass2 diff --git a/ext/zend_test/tests/zend_legacy_iterable.phpt b/ext/zend_test/tests/zend_legacy_iterable.phpt new file mode 100644 index 0000000000000..f55c2b1371e6c --- /dev/null +++ b/ext/zend_test/tests/zend_legacy_iterable.phpt @@ -0,0 +1,31 @@ +--TEST-- +Test that legacy IS_ITERABLE arg info type generates a notice +--EXTENSIONS-- +zend_test +--FILE-- + +==DONE== +--EXPECT-- +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 +array(0) { +} +array(0) { +} +object(Generator)#1 (0) { +} +object(Generator)#1 (0) { +} +==DONE== diff --git a/ext/zend_test/tests/zend_test_compile_string.phpt b/ext/zend_test/tests/zend_test_compile_string.phpt index f2449d86ffa20..3a430899c1ba6 100644 --- a/ext/zend_test/tests/zend_test_compile_string.phpt +++ b/ext/zend_test/tests/zend_test_compile_string.phpt @@ -46,6 +46,9 @@ EOF; zend_test_compile_string($source_string, 'Source string', ZEND_COMPILE_POSITION_AFTER_OPEN_TAG); ?> --EXPECT-- +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 string(3) "php" #!/path/to/php string(3) "php" diff --git a/ext/zend_test/tests/zend_weakmap.phpt b/ext/zend_test/tests/zend_weakmap.phpt index 99a2075c0471f..09cfc2a1ec12e 100644 --- a/ext/zend_test/tests/zend_weakmap.phpt +++ b/ext/zend_test/tests/zend_weakmap.phpt @@ -29,6 +29,9 @@ var_dump(zend_weakmap_dump()); ?> --EXPECTF-- +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 bool(true) bool(false) bool(true) @@ -51,4 +54,4 @@ array(1) { [%s]=> object(stdClass)#2 (0) { } -} \ No newline at end of file +} From f29b2c77df5c9444ced463e03d3a899dd622795b Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Wed, 27 Apr 2022 23:48:02 +0100 Subject: [PATCH 19/28] Warn also if return type is iterable --- Zend/zend_API.c | 5 ++--- ext/zend_test/tests/attribute_arguments.phpt | 2 ++ ext/zend_test/tests/attribute_hash_table_leak.phpt | 2 ++ ext/zend_test/tests/fiber_test_01.phpt | 2 ++ ext/zend_test/tests/fiber_test_02.phpt | 2 ++ ext/zend_test/tests/fiber_test_03.phpt | 2 ++ ext/zend_test/tests/fiber_test_04.phpt | 2 ++ ext/zend_test/tests/fiber_test_05.phpt | 2 ++ ext/zend_test/tests/fiber_test_06.phpt | 2 ++ ext/zend_test/tests/fiber_test_07.phpt | 2 ++ ext/zend_test/tests/gen_stub_test_01.phpt | 2 ++ ext/zend_test/tests/observer_backtrace_01.phpt | 2 ++ ext/zend_test/tests/observer_basic_01.phpt | 2 ++ ext/zend_test/tests/observer_basic_02.phpt | 2 ++ ext/zend_test/tests/observer_basic_03.phpt | 2 ++ ext/zend_test/tests/observer_basic_04.phpt | 2 ++ ext/zend_test/tests/observer_basic_05.phpt | 2 ++ ext/zend_test/tests/observer_bug81430_1.phpt | 2 ++ ext/zend_test/tests/observer_bug81430_2.phpt | 2 ++ ext/zend_test/tests/observer_bug81435.phpt | 2 ++ ext/zend_test/tests/observer_call_user_func_01.phpt | 2 ++ ext/zend_test/tests/observer_call_user_func_02.phpt | 2 ++ ext/zend_test/tests/observer_call_user_func_03.phpt | 2 ++ ext/zend_test/tests/observer_call_user_func_04.phpt | 2 ++ ext/zend_test/tests/observer_closure_01.phpt | 2 ++ ext/zend_test/tests/observer_closure_02.phpt | 2 ++ ext/zend_test/tests/observer_error_01.phpt | 2 ++ ext/zend_test/tests/observer_error_02.phpt | 2 ++ ext/zend_test/tests/observer_error_03.phpt | 2 ++ ext/zend_test/tests/observer_error_04.phpt | 2 ++ ext/zend_test/tests/observer_error_05.phpt | 2 ++ ext/zend_test/tests/observer_eval_01.phpt | 2 ++ ext/zend_test/tests/observer_exception_01.phpt | 2 ++ ext/zend_test/tests/observer_fiber_01.phpt | 2 ++ ext/zend_test/tests/observer_fiber_02.phpt | 2 ++ ext/zend_test/tests/observer_fiber_03.phpt | 2 ++ ext/zend_test/tests/observer_fiber_04.phpt | 2 ++ ext/zend_test/tests/observer_fiber_05.phpt | 2 ++ ext/zend_test/tests/observer_fiber_06.phpt | 2 ++ ext/zend_test/tests/observer_generator_01.phpt | 2 ++ ext/zend_test/tests/observer_generator_02.phpt | 2 ++ ext/zend_test/tests/observer_generator_03.phpt | 2 ++ ext/zend_test/tests/observer_generator_04.phpt | 2 ++ ext/zend_test/tests/observer_generator_05.phpt | 2 ++ ext/zend_test/tests/observer_magic_01.phpt | 2 ++ ext/zend_test/tests/observer_opline_01.phpt | 2 ++ ext/zend_test/tests/observer_retval_01.phpt | 2 ++ ext/zend_test/tests/observer_retval_02.phpt | 2 ++ ext/zend_test/tests/observer_retval_03.phpt | 2 ++ ext/zend_test/tests/observer_retval_04.phpt | 2 ++ ext/zend_test/tests/observer_retval_05.phpt | 2 ++ ext/zend_test/tests/observer_retval_06.phpt | 2 ++ ext/zend_test/tests/observer_retval_07.phpt | 2 ++ ext/zend_test/tests/observer_retval_by_ref_01.phpt | 2 ++ ext/zend_test/tests/observer_retval_by_ref_02.phpt | 2 ++ ext/zend_test/tests/observer_retval_by_ref_03.phpt | 2 ++ ext/zend_test/tests/observer_shutdown_01.phpt | 2 ++ ext/zend_test/tests/observer_shutdown_02.phpt | 2 ++ ext/zend_test/tests/observer_types_01.phpt | 2 ++ ext/zend_test/tests/observer_zend_call_function_01.phpt | 2 ++ ext/zend_test/tests/optimizer_register_pass.phpt | 2 ++ ext/zend_test/tests/zend_legacy_iterable.phpt | 2 ++ ext/zend_test/tests/zend_test_compile_string.phpt | 2 ++ ext/zend_test/tests/zend_weakmap.phpt | 2 ++ 64 files changed, 128 insertions(+), 3 deletions(-) diff --git a/Zend/zend_API.c b/Zend/zend_API.c index 9f7078fb35c5a..053b65494be12 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -2793,8 +2793,6 @@ ZEND_API zend_result zend_register_functions(zend_class_entry *scope, const zend ZEND_ASSERT(arg_info->name && "Parameter must have a name"); if (ZEND_TYPE_IS_SET(arg_info->type)) { if (ZEND_TYPE_IS_ITERABLE_FALLBACK(arg_info->type)) { - zend_error(E_CORE_WARNING, "iterable type is now a compile time alias for array|Traversable," - " regenerate the argument info via the php-src gen_stub build script"); rebuild_arginfo = true; } reg_function->common.fn_flags |= ZEND_ACC_HAS_TYPE_HINTS; @@ -2867,10 +2865,11 @@ ZEND_API zend_result zend_register_functions(zend_class_entry *scope, const zend } } if (ZEND_TYPE_IS_ITERABLE_FALLBACK(new_arg_info[i].type)) { + zend_error(E_CORE_WARNING, "iterable type is now a compile time alias for array|Traversable," + " regenerate the argument info via the php-src gen_stub build script"); zend_type legacy_iterable = ZEND_TYPE_INIT_CLASS_CONST_MASK(ZSTR_KNOWN(ZEND_STR_TRAVERSABLE), (new_arg_info[i].type.type_mask|_ZEND_TYPE_UNION_BIT|MAY_BE_ARRAY)); memcpy(&new_arg_info[i].type, &legacy_iterable, sizeof(zend_type)); - //return FAILURE; } } } diff --git a/ext/zend_test/tests/attribute_arguments.phpt b/ext/zend_test/tests/attribute_arguments.phpt index 9780a960217dd..ed6b816c91043 100644 --- a/ext/zend_test/tests/attribute_arguments.phpt +++ b/ext/zend_test/tests/attribute_arguments.phpt @@ -88,6 +88,8 @@ var_dump($attribute->newInstance()); --EXPECTF-- Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 array(1) { [0]=> diff --git a/ext/zend_test/tests/attribute_hash_table_leak.phpt b/ext/zend_test/tests/attribute_hash_table_leak.phpt index 9bbb66552b000..dbfc60ccd6a8e 100644 --- a/ext/zend_test/tests/attribute_hash_table_leak.phpt +++ b/ext/zend_test/tests/attribute_hash_table_leak.phpt @@ -57,6 +57,8 @@ var_dump($o->override("foo")); --EXPECT-- Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 int(1) int(2) diff --git a/ext/zend_test/tests/fiber_test_01.phpt b/ext/zend_test/tests/fiber_test_01.phpt index c9716b61d071f..4a9d12dd1ba19 100644 --- a/ext/zend_test/tests/fiber_test_01.phpt +++ b/ext/zend_test/tests/fiber_test_01.phpt @@ -23,6 +23,8 @@ var_dump($fiber->getReturn()); // int(1) --EXPECT-- Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 int(123) int(246) diff --git a/ext/zend_test/tests/fiber_test_02.phpt b/ext/zend_test/tests/fiber_test_02.phpt index 64b5479665f5a..2dd62d8273b0b 100644 --- a/ext/zend_test/tests/fiber_test_02.phpt +++ b/ext/zend_test/tests/fiber_test_02.phpt @@ -19,6 +19,8 @@ var_dump($test->resume(2)); // NULL --EXPECT-- Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 int(1) int(2) diff --git a/ext/zend_test/tests/fiber_test_03.phpt b/ext/zend_test/tests/fiber_test_03.phpt index bda9a032c613e..05078cb809088 100644 --- a/ext/zend_test/tests/fiber_test_03.phpt +++ b/ext/zend_test/tests/fiber_test_03.phpt @@ -24,6 +24,8 @@ $value = $fiber->throw(new Exception('test')); --EXPECTF-- Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 int(1) int(2) diff --git a/ext/zend_test/tests/fiber_test_04.phpt b/ext/zend_test/tests/fiber_test_04.phpt index 6cf58259bc5f4..e09c8b0538a41 100644 --- a/ext/zend_test/tests/fiber_test_04.phpt +++ b/ext/zend_test/tests/fiber_test_04.phpt @@ -32,6 +32,8 @@ var_dump($fiber->getReturn()); // int(-1) --EXPECT-- Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 int(1) int(2) diff --git a/ext/zend_test/tests/fiber_test_05.phpt b/ext/zend_test/tests/fiber_test_05.phpt index 2f19241e6f755..d74b4a590f4a6 100644 --- a/ext/zend_test/tests/fiber_test_05.phpt +++ b/ext/zend_test/tests/fiber_test_05.phpt @@ -30,6 +30,8 @@ $value = $test->resume(2 * $value); --EXPECT-- Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 int(1) int(2) diff --git a/ext/zend_test/tests/fiber_test_06.phpt b/ext/zend_test/tests/fiber_test_06.phpt index ee0fe3f792803..236877969336f 100644 --- a/ext/zend_test/tests/fiber_test_06.phpt +++ b/ext/zend_test/tests/fiber_test_06.phpt @@ -31,6 +31,8 @@ var_dump($fiber->resume('2')); // NULL --EXPECT-- Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 int(10) int(1) diff --git a/ext/zend_test/tests/fiber_test_07.phpt b/ext/zend_test/tests/fiber_test_07.phpt index c4dc60e550001..1bcbe0f745250 100644 --- a/ext/zend_test/tests/fiber_test_07.phpt +++ b/ext/zend_test/tests/fiber_test_07.phpt @@ -19,6 +19,8 @@ var_dump($fiber->start()); --EXPECT-- Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 int(1) NULL diff --git a/ext/zend_test/tests/gen_stub_test_01.phpt b/ext/zend_test/tests/gen_stub_test_01.phpt index 4e2ebe8961660..de9eb2693af65 100644 --- a/ext/zend_test/tests/gen_stub_test_01.phpt +++ b/ext/zend_test/tests/gen_stub_test_01.phpt @@ -13,6 +13,8 @@ var_dump($foo); --EXPECTF-- Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 object(ZendTestNS2\Foo)#%d (%d) { ["foo"]=> diff --git a/ext/zend_test/tests/observer_backtrace_01.phpt b/ext/zend_test/tests/observer_backtrace_01.phpt index d34af63354372..bd1d06a5fbf60 100644 --- a/ext/zend_test/tests/observer_backtrace_01.phpt +++ b/ext/zend_test/tests/observer_backtrace_01.phpt @@ -39,6 +39,8 @@ var_dump(foo()); --EXPECTF-- Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_basic_02.phpt b/ext/zend_test/tests/observer_basic_02.phpt index b3a5b9f24e1dd..6441c47217e32 100644 --- a/ext/zend_test/tests/observer_basic_02.phpt +++ b/ext/zend_test/tests/observer_basic_02.phpt @@ -32,6 +32,8 @@ echo 'DONE' . PHP_EOL; --EXPECTF-- Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_basic_03.phpt b/ext/zend_test/tests/observer_basic_03.phpt index e5fe269c3e766..f46ad2ad2a03c 100644 --- a/ext/zend_test/tests/observer_basic_03.phpt +++ b/ext/zend_test/tests/observer_basic_03.phpt @@ -19,6 +19,8 @@ foo(); --EXPECTF-- Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_basic_04.phpt b/ext/zend_test/tests/observer_basic_04.phpt index 16cc82ddb56aa..1d6ebb6459e93 100644 --- a/ext/zend_test/tests/observer_basic_04.phpt +++ b/ext/zend_test/tests/observer_basic_04.phpt @@ -19,6 +19,8 @@ foo(); --EXPECTF-- Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_basic_05.phpt b/ext/zend_test/tests/observer_basic_05.phpt index 3dcf0f2bfe70a..8967981eecfd0 100644 --- a/ext/zend_test/tests/observer_basic_05.phpt +++ b/ext/zend_test/tests/observer_basic_05.phpt @@ -19,6 +19,8 @@ foo(); --EXPECTF-- Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_bug81430_1.phpt b/ext/zend_test/tests/observer_bug81430_1.phpt index 7d1a36d9fc134..5f3e4b909d573 100644 --- a/ext/zend_test/tests/observer_bug81430_1.phpt +++ b/ext/zend_test/tests/observer_bug81430_1.phpt @@ -25,6 +25,8 @@ call_user_func([$r->getAttributes(A::class)[0], 'newInstance']); --EXPECTF-- Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_bug81430_2.phpt b/ext/zend_test/tests/observer_bug81430_2.phpt index 892436e028439..becf2618b46e3 100644 --- a/ext/zend_test/tests/observer_bug81430_2.phpt +++ b/ext/zend_test/tests/observer_bug81430_2.phpt @@ -25,6 +25,8 @@ call_user_func([$r->getAttributes(A::class)[0], 'newInstance']); --EXPECTF-- Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_bug81435.phpt b/ext/zend_test/tests/observer_bug81435.phpt index 01bdfeeb154fb..d21332735f7d3 100644 --- a/ext/zend_test/tests/observer_bug81435.phpt +++ b/ext/zend_test/tests/observer_bug81435.phpt @@ -35,6 +35,8 @@ a(); --EXPECTF-- Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_call_user_func_01.phpt b/ext/zend_test/tests/observer_call_user_func_01.phpt index 9bd825a811ff3..67d02b7ed5f94 100644 --- a/ext/zend_test/tests/observer_call_user_func_01.phpt +++ b/ext/zend_test/tests/observer_call_user_func_01.phpt @@ -29,6 +29,8 @@ namespace { --EXPECTF-- Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_call_user_func_02.phpt b/ext/zend_test/tests/observer_call_user_func_02.phpt index 30d55c17cf744..5c5a7c4c97c37 100644 --- a/ext/zend_test/tests/observer_call_user_func_02.phpt +++ b/ext/zend_test/tests/observer_call_user_func_02.phpt @@ -29,6 +29,8 @@ namespace { --EXPECTF-- Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_call_user_func_03.phpt b/ext/zend_test/tests/observer_call_user_func_03.phpt index ae28f93bd5d40..f004cdb3dbaf2 100644 --- a/ext/zend_test/tests/observer_call_user_func_03.phpt +++ b/ext/zend_test/tests/observer_call_user_func_03.phpt @@ -28,6 +28,8 @@ namespace Test { --EXPECTF-- Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_call_user_func_04.phpt b/ext/zend_test/tests/observer_call_user_func_04.phpt index 90767d3b79698..a28695ede592a 100644 --- a/ext/zend_test/tests/observer_call_user_func_04.phpt +++ b/ext/zend_test/tests/observer_call_user_func_04.phpt @@ -28,6 +28,8 @@ namespace Test { --EXPECTF-- Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_closure_01.phpt b/ext/zend_test/tests/observer_closure_01.phpt index 1208043453d7c..7b41765a76d4f 100644 --- a/ext/zend_test/tests/observer_closure_01.phpt +++ b/ext/zend_test/tests/observer_closure_01.phpt @@ -25,6 +25,8 @@ echo 'DONE' . PHP_EOL; --EXPECTF-- Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_closure_02.phpt b/ext/zend_test/tests/observer_closure_02.phpt index 0fe834a07cd42..5c98e9a7ab47c 100644 --- a/ext/zend_test/tests/observer_closure_02.phpt +++ b/ext/zend_test/tests/observer_closure_02.phpt @@ -24,6 +24,8 @@ echo 'DONE' . PHP_EOL; --EXPECTF-- Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_error_01.phpt b/ext/zend_test/tests/observer_error_01.phpt index dbec38aa250c9..9672361e1cf38 100644 --- a/ext/zend_test/tests/observer_error_01.phpt +++ b/ext/zend_test/tests/observer_error_01.phpt @@ -21,6 +21,8 @@ echo 'You should not see this.'; --EXPECTF-- Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_error_02.phpt b/ext/zend_test/tests/observer_error_02.phpt index a7a0dfce933c8..c9e22d3543680 100644 --- a/ext/zend_test/tests/observer_error_02.phpt +++ b/ext/zend_test/tests/observer_error_02.phpt @@ -20,6 +20,8 @@ echo 'You should not see this.'; --EXPECTF-- Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_error_03.phpt b/ext/zend_test/tests/observer_error_03.phpt index 13f80c49d2a9f..e1b00f9cbf2ef 100644 --- a/ext/zend_test/tests/observer_error_03.phpt +++ b/ext/zend_test/tests/observer_error_03.phpt @@ -26,6 +26,8 @@ echo 'Done.' . PHP_EOL; --EXPECTF-- Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_error_04.phpt b/ext/zend_test/tests/observer_error_04.phpt index f67eaa915fadb..6b3341e15ea38 100644 --- a/ext/zend_test/tests/observer_error_04.phpt +++ b/ext/zend_test/tests/observer_error_04.phpt @@ -32,6 +32,8 @@ echo 'Done.' . PHP_EOL; --EXPECTF-- Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_error_05.phpt b/ext/zend_test/tests/observer_error_05.phpt index dcc9842724422..33b46d1ae6fb7 100644 --- a/ext/zend_test/tests/observer_error_05.phpt +++ b/ext/zend_test/tests/observer_error_05.phpt @@ -24,6 +24,8 @@ echo 'You should not see this.'; --EXPECTF-- Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_eval_01.phpt b/ext/zend_test/tests/observer_eval_01.phpt index 0d0a3c05e25d8..2a9d840c3697d 100644 --- a/ext/zend_test/tests/observer_eval_01.phpt +++ b/ext/zend_test/tests/observer_eval_01.phpt @@ -13,6 +13,8 @@ echo 'DONE' . PHP_EOL; --EXPECTF-- Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_exception_01.phpt b/ext/zend_test/tests/observer_exception_01.phpt index 9f3fc783cc08a..dffaca53c0536 100644 --- a/ext/zend_test/tests/observer_exception_01.phpt +++ b/ext/zend_test/tests/observer_exception_01.phpt @@ -25,6 +25,8 @@ echo 'You should not see this' . PHP_EOL; --EXPECTF-- Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_fiber_01.phpt b/ext/zend_test/tests/observer_fiber_01.phpt index 65669767b5b2a..abc216792eca1 100644 --- a/ext/zend_test/tests/observer_fiber_01.phpt +++ b/ext/zend_test/tests/observer_fiber_01.phpt @@ -21,6 +21,8 @@ $fiber->resume(); --EXPECTF-- Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_fiber_02.phpt b/ext/zend_test/tests/observer_fiber_02.phpt index 4977babcc33dc..088fea8b0a211 100644 --- a/ext/zend_test/tests/observer_fiber_02.phpt +++ b/ext/zend_test/tests/observer_fiber_02.phpt @@ -18,6 +18,8 @@ $fiber->start(); --EXPECTF-- Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_fiber_03.phpt b/ext/zend_test/tests/observer_fiber_03.phpt index 21a605000023c..699b7385b9d1f 100644 --- a/ext/zend_test/tests/observer_fiber_03.phpt +++ b/ext/zend_test/tests/observer_fiber_03.phpt @@ -41,6 +41,8 @@ $fiber->resume(); --EXPECTF-- Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_fiber_04.phpt b/ext/zend_test/tests/observer_fiber_04.phpt index 07661fc9ff249..790c2c8f8c1a0 100644 --- a/ext/zend_test/tests/observer_fiber_04.phpt +++ b/ext/zend_test/tests/observer_fiber_04.phpt @@ -28,6 +28,8 @@ $fiber->resume(); --EXPECTF-- Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_fiber_05.phpt b/ext/zend_test/tests/observer_fiber_05.phpt index 06c9122963ea4..e3536dc56c6a5 100644 --- a/ext/zend_test/tests/observer_fiber_05.phpt +++ b/ext/zend_test/tests/observer_fiber_05.phpt @@ -27,6 +27,8 @@ $fiber->resume(); --EXPECTF-- Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_fiber_06.phpt b/ext/zend_test/tests/observer_fiber_06.phpt index 7d901b2c2b643..20383162706b8 100644 --- a/ext/zend_test/tests/observer_fiber_06.phpt +++ b/ext/zend_test/tests/observer_fiber_06.phpt @@ -24,6 +24,8 @@ try { --EXPECTF-- Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_generator_01.phpt b/ext/zend_test/tests/observer_generator_01.phpt index 19e85b7395214..2d194b7e1cddb 100644 --- a/ext/zend_test/tests/observer_generator_01.phpt +++ b/ext/zend_test/tests/observer_generator_01.phpt @@ -28,6 +28,8 @@ echo doSomething() . PHP_EOL; --EXPECTF-- Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_generator_02.phpt b/ext/zend_test/tests/observer_generator_02.phpt index a972ec7376f4f..670bc0d53db6d 100644 --- a/ext/zend_test/tests/observer_generator_02.phpt +++ b/ext/zend_test/tests/observer_generator_02.phpt @@ -30,6 +30,8 @@ echo doSomething() . PHP_EOL; --EXPECTF-- Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_generator_03.phpt b/ext/zend_test/tests/observer_generator_03.phpt index f2d8a1b327f8f..6ae67eeda6153 100644 --- a/ext/zend_test/tests/observer_generator_03.phpt +++ b/ext/zend_test/tests/observer_generator_03.phpt @@ -35,6 +35,8 @@ echo doSomething() . PHP_EOL; --EXPECTF-- Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_generator_04.phpt b/ext/zend_test/tests/observer_generator_04.phpt index 19df6d2690ec8..f361fa1239fe1 100644 --- a/ext/zend_test/tests/observer_generator_04.phpt +++ b/ext/zend_test/tests/observer_generator_04.phpt @@ -35,6 +35,8 @@ echo doSomething() . PHP_EOL; --EXPECTF-- Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_generator_05.phpt b/ext/zend_test/tests/observer_generator_05.phpt index e5b3044a19508..9ccc8c835496e 100644 --- a/ext/zend_test/tests/observer_generator_05.phpt +++ b/ext/zend_test/tests/observer_generator_05.phpt @@ -28,6 +28,8 @@ echo doSomething() . PHP_EOL; --EXPECTF-- Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_magic_01.phpt b/ext/zend_test/tests/observer_magic_01.phpt index 48af223ca7780..749c7932ea4c2 100644 --- a/ext/zend_test/tests/observer_magic_01.phpt +++ b/ext/zend_test/tests/observer_magic_01.phpt @@ -30,6 +30,8 @@ echo 'DONE' . PHP_EOL; --EXPECTF-- Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_opline_01.phpt b/ext/zend_test/tests/observer_opline_01.phpt index 2705da92dc792..fa43a162caba5 100644 --- a/ext/zend_test/tests/observer_opline_01.phpt +++ b/ext/zend_test/tests/observer_opline_01.phpt @@ -22,6 +22,8 @@ foo(); --EXPECTF-- Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_retval_01.phpt b/ext/zend_test/tests/observer_retval_01.phpt index c2c8c19705b2e..4868cee36d77b 100644 --- a/ext/zend_test/tests/observer_retval_01.phpt +++ b/ext/zend_test/tests/observer_retval_01.phpt @@ -21,6 +21,8 @@ echo 'Done' . PHP_EOL; --EXPECTF-- Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_retval_02.phpt b/ext/zend_test/tests/observer_retval_02.phpt index 3ad111ddcf10d..13f90c2dafea4 100644 --- a/ext/zend_test/tests/observer_retval_02.phpt +++ b/ext/zend_test/tests/observer_retval_02.phpt @@ -23,6 +23,8 @@ echo 'Done' . PHP_EOL; --EXPECTF-- Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_retval_03.phpt b/ext/zend_test/tests/observer_retval_03.phpt index 7cfc67668121d..90ebcdcb0a269 100644 --- a/ext/zend_test/tests/observer_retval_03.phpt +++ b/ext/zend_test/tests/observer_retval_03.phpt @@ -23,6 +23,8 @@ echo 'Done' . PHP_EOL; --EXPECTF-- Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_retval_04.phpt b/ext/zend_test/tests/observer_retval_04.phpt index 8fd163d3e00ba..e0b2e39406ac6 100644 --- a/ext/zend_test/tests/observer_retval_04.phpt +++ b/ext/zend_test/tests/observer_retval_04.phpt @@ -33,6 +33,8 @@ echo 'Done' . PHP_EOL; --EXPECTF-- Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_retval_05.phpt b/ext/zend_test/tests/observer_retval_05.phpt index b18b0e5136347..374acc1c79c6b 100644 --- a/ext/zend_test/tests/observer_retval_05.phpt +++ b/ext/zend_test/tests/observer_retval_05.phpt @@ -20,6 +20,8 @@ echo 'Done' . PHP_EOL; --EXPECTF-- Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_retval_06.phpt b/ext/zend_test/tests/observer_retval_06.phpt index 6d6a0f6606743..da5aaa7efcff9 100644 --- a/ext/zend_test/tests/observer_retval_06.phpt +++ b/ext/zend_test/tests/observer_retval_06.phpt @@ -21,6 +21,8 @@ echo 'Done' . PHP_EOL; --EXPECTF-- Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_retval_07.phpt b/ext/zend_test/tests/observer_retval_07.phpt index 619b233394f65..ed798950d89d8 100644 --- a/ext/zend_test/tests/observer_retval_07.phpt +++ b/ext/zend_test/tests/observer_retval_07.phpt @@ -25,6 +25,8 @@ echo 'Done' . PHP_EOL; --EXPECTF-- Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_retval_by_ref_01.phpt b/ext/zend_test/tests/observer_retval_by_ref_01.phpt index caee2ffe01a01..6fd43d6d32c15 100644 --- a/ext/zend_test/tests/observer_retval_by_ref_01.phpt +++ b/ext/zend_test/tests/observer_retval_by_ref_01.phpt @@ -21,6 +21,8 @@ echo 'Done' . PHP_EOL; --EXPECTF-- Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_retval_by_ref_02.phpt b/ext/zend_test/tests/observer_retval_by_ref_02.phpt index 00d75e4f0b00a..cca7ab3c637d9 100644 --- a/ext/zend_test/tests/observer_retval_by_ref_02.phpt +++ b/ext/zend_test/tests/observer_retval_by_ref_02.phpt @@ -21,6 +21,8 @@ echo 'Done' . PHP_EOL; --EXPECTF-- Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_retval_by_ref_03.phpt b/ext/zend_test/tests/observer_retval_by_ref_03.phpt index 2c3a00e726488..9480fe0072e2d 100644 --- a/ext/zend_test/tests/observer_retval_by_ref_03.phpt +++ b/ext/zend_test/tests/observer_retval_by_ref_03.phpt @@ -25,6 +25,8 @@ echo 'Done' . PHP_EOL; --EXPECTF-- Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_shutdown_01.phpt b/ext/zend_test/tests/observer_shutdown_01.phpt index 9ce8b62c017a7..ebf24adeceeb6 100644 --- a/ext/zend_test/tests/observer_shutdown_01.phpt +++ b/ext/zend_test/tests/observer_shutdown_01.phpt @@ -26,6 +26,8 @@ echo 'Done: ' . bar(40) . PHP_EOL; --EXPECTF-- Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_shutdown_02.phpt b/ext/zend_test/tests/observer_shutdown_02.phpt index 7425ecd83ccb0..7fd414752f630 100644 --- a/ext/zend_test/tests/observer_shutdown_02.phpt +++ b/ext/zend_test/tests/observer_shutdown_02.phpt @@ -32,6 +32,8 @@ echo 'Done: ' . bar(40) . PHP_EOL; --EXPECTF-- Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_types_01.phpt b/ext/zend_test/tests/observer_types_01.phpt index c35d5026f7a02..4cc059639d053 100644 --- a/ext/zend_test/tests/observer_types_01.phpt +++ b/ext/zend_test/tests/observer_types_01.phpt @@ -14,6 +14,8 @@ foo(42); --EXPECTF-- Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_zend_call_function_01.phpt b/ext/zend_test/tests/observer_zend_call_function_01.phpt index b6c7f886425ad..2ade33bf89373 100644 --- a/ext/zend_test/tests/observer_zend_call_function_01.phpt +++ b/ext/zend_test/tests/observer_zend_call_function_01.phpt @@ -20,6 +20,8 @@ echo 'Done' . PHP_EOL; --EXPECTF-- Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/optimizer_register_pass.phpt b/ext/zend_test/tests/optimizer_register_pass.phpt index fb1cee769466d..b6878b948971c 100644 --- a/ext/zend_test/tests/optimizer_register_pass.phpt +++ b/ext/zend_test/tests/optimizer_register_pass.phpt @@ -24,6 +24,8 @@ zend_test.register_passes=1 --EXPECT-- Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 pass1 pass2 diff --git a/ext/zend_test/tests/zend_legacy_iterable.phpt b/ext/zend_test/tests/zend_legacy_iterable.phpt index f55c2b1371e6c..1316a095f6893 100644 --- a/ext/zend_test/tests/zend_legacy_iterable.phpt +++ b/ext/zend_test/tests/zend_legacy_iterable.phpt @@ -19,6 +19,8 @@ var_dump(zend_iterable_legacy(gen(), gen())); --EXPECT-- Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 array(0) { } diff --git a/ext/zend_test/tests/zend_test_compile_string.phpt b/ext/zend_test/tests/zend_test_compile_string.phpt index 3a430899c1ba6..412c899923cf7 100644 --- a/ext/zend_test/tests/zend_test_compile_string.phpt +++ b/ext/zend_test/tests/zend_test_compile_string.phpt @@ -48,6 +48,8 @@ zend_test_compile_string($source_string, 'Source string', ZEND_COMPILE_POSITION_ --EXPECT-- Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 string(3) "php" #!/path/to/php diff --git a/ext/zend_test/tests/zend_weakmap.phpt b/ext/zend_test/tests/zend_weakmap.phpt index 09cfc2a1ec12e..0cbc094ee799a 100644 --- a/ext/zend_test/tests/zend_weakmap.phpt +++ b/ext/zend_test/tests/zend_weakmap.phpt @@ -31,6 +31,8 @@ var_dump(zend_weakmap_dump()); --EXPECTF-- Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 +Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 + Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 bool(true) bool(false) From 8b479f09c8bf27b8aed5ff6fa05cb473aec6d145 Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Thu, 28 Apr 2022 00:05:41 +0100 Subject: [PATCH 20/28] Do not test statup in effect --- ext/zend_test/test.c | 4 ++-- ext/zend_test/tests/attribute_arguments.phpt | 5 ----- ext/zend_test/tests/attribute_hash_table_leak.phpt | 5 ----- ext/zend_test/tests/fiber_test_01.phpt | 5 ----- ext/zend_test/tests/fiber_test_02.phpt | 5 ----- ext/zend_test/tests/fiber_test_03.phpt | 5 ----- ext/zend_test/tests/fiber_test_04.phpt | 5 ----- ext/zend_test/tests/fiber_test_05.phpt | 5 ----- ext/zend_test/tests/fiber_test_06.phpt | 5 ----- ext/zend_test/tests/fiber_test_07.phpt | 5 ----- ext/zend_test/tests/gen_stub_test_01.phpt | 5 ----- ext/zend_test/tests/observer_backtrace_01.phpt | 5 ----- ext/zend_test/tests/observer_basic_01.phpt | 5 ----- ext/zend_test/tests/observer_basic_02.phpt | 5 ----- ext/zend_test/tests/observer_basic_03.phpt | 5 ----- ext/zend_test/tests/observer_basic_04.phpt | 5 ----- ext/zend_test/tests/observer_basic_05.phpt | 5 ----- ext/zend_test/tests/observer_bug81430_1.phpt | 5 ----- ext/zend_test/tests/observer_bug81430_2.phpt | 5 ----- ext/zend_test/tests/observer_bug81435.phpt | 5 ----- ext/zend_test/tests/observer_call_user_func_01.phpt | 5 ----- ext/zend_test/tests/observer_call_user_func_02.phpt | 5 ----- ext/zend_test/tests/observer_call_user_func_03.phpt | 5 ----- ext/zend_test/tests/observer_call_user_func_04.phpt | 5 ----- ext/zend_test/tests/observer_closure_01.phpt | 5 ----- ext/zend_test/tests/observer_closure_02.phpt | 5 ----- ext/zend_test/tests/observer_error_01.phpt | 5 ----- ext/zend_test/tests/observer_error_02.phpt | 5 ----- ext/zend_test/tests/observer_error_03.phpt | 5 ----- ext/zend_test/tests/observer_error_04.phpt | 5 ----- ext/zend_test/tests/observer_error_05.phpt | 5 ----- ext/zend_test/tests/observer_eval_01.phpt | 5 ----- ext/zend_test/tests/observer_exception_01.phpt | 5 ----- ext/zend_test/tests/observer_fiber_01.phpt | 5 ----- ext/zend_test/tests/observer_fiber_02.phpt | 5 ----- ext/zend_test/tests/observer_fiber_03.phpt | 5 ----- ext/zend_test/tests/observer_fiber_04.phpt | 5 ----- ext/zend_test/tests/observer_fiber_05.phpt | 5 ----- ext/zend_test/tests/observer_fiber_06.phpt | 5 ----- ext/zend_test/tests/observer_generator_01.phpt | 5 ----- ext/zend_test/tests/observer_generator_02.phpt | 5 ----- ext/zend_test/tests/observer_generator_03.phpt | 5 ----- ext/zend_test/tests/observer_generator_04.phpt | 5 ----- ext/zend_test/tests/observer_generator_05.phpt | 5 ----- ext/zend_test/tests/observer_magic_01.phpt | 5 ----- ext/zend_test/tests/observer_opline_01.phpt | 5 ----- ext/zend_test/tests/observer_retval_01.phpt | 5 ----- ext/zend_test/tests/observer_retval_02.phpt | 5 ----- ext/zend_test/tests/observer_retval_03.phpt | 5 ----- ext/zend_test/tests/observer_retval_04.phpt | 5 ----- ext/zend_test/tests/observer_retval_05.phpt | 5 ----- ext/zend_test/tests/observer_retval_06.phpt | 5 ----- ext/zend_test/tests/observer_retval_07.phpt | 5 ----- ext/zend_test/tests/observer_retval_by_ref_01.phpt | 5 ----- ext/zend_test/tests/observer_retval_by_ref_02.phpt | 5 ----- ext/zend_test/tests/observer_retval_by_ref_03.phpt | 5 ----- ext/zend_test/tests/observer_shutdown_01.phpt | 5 ----- ext/zend_test/tests/observer_shutdown_02.phpt | 5 ----- ext/zend_test/tests/observer_types_01.phpt | 5 ----- ext/zend_test/tests/observer_zend_call_function_01.phpt | 5 ----- ext/zend_test/tests/optimizer_register_pass.phpt | 5 ----- ext/zend_test/tests/zend_legacy_iterable.phpt | 5 +++++ ext/zend_test/tests/zend_test_compile_string.phpt | 5 ----- ext/zend_test/tests/zend_weakmap.phpt | 5 ----- 64 files changed, 7 insertions(+), 312 deletions(-) diff --git a/ext/zend_test/test.c b/ext/zend_test/test.c index 3d56622c6b5b3..15950c709342b 100644 --- a/ext/zend_test/test.c +++ b/ext/zend_test/test.c @@ -651,8 +651,8 @@ PHP_MINIT_FUNCTION(zend_test) zend_test_string_enum = register_class_ZendTestStringEnum(); zend_test_int_enum = register_class_ZendTestIntEnum(); - /* Register legacy iterable function */ - zend_register_functions(NULL, ext_function_legacy, NULL, EG(current_module)->type); + /* Register legacy iterable function, this generates E_CORE_WARNING on startup */ + //zend_register_functions(NULL, ext_function_legacy, NULL, EG(current_module)->type); // Loading via dl() not supported with the observer API if (type != MODULE_TEMPORARY) { diff --git a/ext/zend_test/tests/attribute_arguments.phpt b/ext/zend_test/tests/attribute_arguments.phpt index ed6b816c91043..e1ec8a89d9a00 100644 --- a/ext/zend_test/tests/attribute_arguments.phpt +++ b/ext/zend_test/tests/attribute_arguments.phpt @@ -86,11 +86,6 @@ var_dump($attribute->newInstance()); ?> --EXPECTF-- -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 array(1) { [0]=> string(6) "value1" diff --git a/ext/zend_test/tests/attribute_hash_table_leak.phpt b/ext/zend_test/tests/attribute_hash_table_leak.phpt index dbfc60ccd6a8e..10c786393589e 100644 --- a/ext/zend_test/tests/attribute_hash_table_leak.phpt +++ b/ext/zend_test/tests/attribute_hash_table_leak.phpt @@ -55,11 +55,6 @@ var_dump($o->override("foo")); ?> --EXPECT-- -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 int(1) int(2) int(3) diff --git a/ext/zend_test/tests/fiber_test_01.phpt b/ext/zend_test/tests/fiber_test_01.phpt index 4a9d12dd1ba19..d0ebcbdee5a96 100644 --- a/ext/zend_test/tests/fiber_test_01.phpt +++ b/ext/zend_test/tests/fiber_test_01.phpt @@ -21,11 +21,6 @@ var_dump($fiber->getReturn()); // int(1) ?> --EXPECT-- -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 int(123) int(246) NULL diff --git a/ext/zend_test/tests/fiber_test_02.phpt b/ext/zend_test/tests/fiber_test_02.phpt index 2dd62d8273b0b..23cc9b0d68195 100644 --- a/ext/zend_test/tests/fiber_test_02.phpt +++ b/ext/zend_test/tests/fiber_test_02.phpt @@ -17,11 +17,6 @@ var_dump($test->resume(2)); // NULL ?> --EXPECT-- -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 int(1) int(2) NULL diff --git a/ext/zend_test/tests/fiber_test_03.phpt b/ext/zend_test/tests/fiber_test_03.phpt index 05078cb809088..3641608ae5971 100644 --- a/ext/zend_test/tests/fiber_test_03.phpt +++ b/ext/zend_test/tests/fiber_test_03.phpt @@ -22,11 +22,6 @@ $value = $fiber->throw(new Exception('test')); ?> --EXPECTF-- -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 int(1) int(2) int(3) diff --git a/ext/zend_test/tests/fiber_test_04.phpt b/ext/zend_test/tests/fiber_test_04.phpt index e09c8b0538a41..4b7cdd3398fc6 100644 --- a/ext/zend_test/tests/fiber_test_04.phpt +++ b/ext/zend_test/tests/fiber_test_04.phpt @@ -30,11 +30,6 @@ var_dump($fiber->getReturn()); // int(-1) ?> --EXPECT-- -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 int(1) int(2) int(3) diff --git a/ext/zend_test/tests/fiber_test_05.phpt b/ext/zend_test/tests/fiber_test_05.phpt index d74b4a590f4a6..adba08c39652f 100644 --- a/ext/zend_test/tests/fiber_test_05.phpt +++ b/ext/zend_test/tests/fiber_test_05.phpt @@ -28,11 +28,6 @@ $value = $test->resume(2 * $value); ?> --EXPECT-- -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 int(1) int(2) int(3) diff --git a/ext/zend_test/tests/fiber_test_06.phpt b/ext/zend_test/tests/fiber_test_06.phpt index 236877969336f..67b9067023cb3 100644 --- a/ext/zend_test/tests/fiber_test_06.phpt +++ b/ext/zend_test/tests/fiber_test_06.phpt @@ -29,11 +29,6 @@ var_dump($fiber->resume('2')); // NULL ?> --EXPECT-- -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 int(10) int(1) string(1) "1" diff --git a/ext/zend_test/tests/fiber_test_07.phpt b/ext/zend_test/tests/fiber_test_07.phpt index 1bcbe0f745250..0c5c08234cda0 100644 --- a/ext/zend_test/tests/fiber_test_07.phpt +++ b/ext/zend_test/tests/fiber_test_07.phpt @@ -17,10 +17,5 @@ var_dump($fiber->start()); ?> --EXPECT-- -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 int(1) NULL diff --git a/ext/zend_test/tests/gen_stub_test_01.phpt b/ext/zend_test/tests/gen_stub_test_01.phpt index de9eb2693af65..8b13cbaa034b3 100644 --- a/ext/zend_test/tests/gen_stub_test_01.phpt +++ b/ext/zend_test/tests/gen_stub_test_01.phpt @@ -11,11 +11,6 @@ $foo->foo = new \ZendTestNS2\ZendSubNS\Foo(); var_dump($foo); ?> --EXPECTF-- -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 object(ZendTestNS2\Foo)#%d (%d) { ["foo"]=> uninitialized(ZendTestNS2\ZendSubNS\Foo) diff --git a/ext/zend_test/tests/observer_backtrace_01.phpt b/ext/zend_test/tests/observer_backtrace_01.phpt index bd1d06a5fbf60..875a04c395f36 100644 --- a/ext/zend_test/tests/observer_backtrace_01.phpt +++ b/ext/zend_test/tests/observer_backtrace_01.phpt @@ -37,11 +37,6 @@ function foo() var_dump(foo()); ?> --EXPECTF-- -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_basic_02.phpt b/ext/zend_test/tests/observer_basic_02.phpt index 6441c47217e32..adbdc7818151f 100644 --- a/ext/zend_test/tests/observer_basic_02.phpt +++ b/ext/zend_test/tests/observer_basic_02.phpt @@ -30,11 +30,6 @@ $test->foo(); echo 'DONE' . PHP_EOL; ?> --EXPECTF-- -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_basic_03.phpt b/ext/zend_test/tests/observer_basic_03.phpt index f46ad2ad2a03c..f98390a0c986a 100644 --- a/ext/zend_test/tests/observer_basic_03.phpt +++ b/ext/zend_test/tests/observer_basic_03.phpt @@ -17,11 +17,6 @@ include __DIR__ . '/observer.inc'; foo(); ?> --EXPECTF-- -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_basic_04.phpt b/ext/zend_test/tests/observer_basic_04.phpt index 1d6ebb6459e93..1b55f6da3d272 100644 --- a/ext/zend_test/tests/observer_basic_04.phpt +++ b/ext/zend_test/tests/observer_basic_04.phpt @@ -17,11 +17,6 @@ include __DIR__ . '/observer.inc'; foo(); ?> --EXPECTF-- -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_basic_05.phpt b/ext/zend_test/tests/observer_basic_05.phpt index 8967981eecfd0..1891cd87ae49b 100644 --- a/ext/zend_test/tests/observer_basic_05.phpt +++ b/ext/zend_test/tests/observer_basic_05.phpt @@ -17,11 +17,6 @@ include __DIR__ . '/observer.inc'; foo(); ?> --EXPECTF-- -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_bug81430_1.phpt b/ext/zend_test/tests/observer_bug81430_1.phpt index 5f3e4b909d573..cac53ef70cbbb 100644 --- a/ext/zend_test/tests/observer_bug81430_1.phpt +++ b/ext/zend_test/tests/observer_bug81430_1.phpt @@ -23,11 +23,6 @@ $r = new \ReflectionFunction("B"); call_user_func([$r->getAttributes(A::class)[0], 'newInstance']); ?> --EXPECTF-- -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_bug81430_2.phpt b/ext/zend_test/tests/observer_bug81430_2.phpt index becf2618b46e3..4d56248a80f34 100644 --- a/ext/zend_test/tests/observer_bug81430_2.phpt +++ b/ext/zend_test/tests/observer_bug81430_2.phpt @@ -23,11 +23,6 @@ $r = new \ReflectionFunction("B"); call_user_func([$r->getAttributes(A::class)[0], 'newInstance']); ?> --EXPECTF-- -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_bug81435.phpt b/ext/zend_test/tests/observer_bug81435.phpt index d21332735f7d3..2b78c50993160 100644 --- a/ext/zend_test/tests/observer_bug81435.phpt +++ b/ext/zend_test/tests/observer_bug81435.phpt @@ -33,11 +33,6 @@ a(); ?> --EXPECTF-- -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_call_user_func_01.phpt b/ext/zend_test/tests/observer_call_user_func_01.phpt index 67d02b7ed5f94..f4a25a0372310 100644 --- a/ext/zend_test/tests/observer_call_user_func_01.phpt +++ b/ext/zend_test/tests/observer_call_user_func_01.phpt @@ -27,11 +27,6 @@ namespace { } ?> --EXPECTF-- -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_call_user_func_02.phpt b/ext/zend_test/tests/observer_call_user_func_02.phpt index 5c5a7c4c97c37..30a4b08f3fc03 100644 --- a/ext/zend_test/tests/observer_call_user_func_02.phpt +++ b/ext/zend_test/tests/observer_call_user_func_02.phpt @@ -27,11 +27,6 @@ namespace { } ?> --EXPECTF-- -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_call_user_func_03.phpt b/ext/zend_test/tests/observer_call_user_func_03.phpt index f004cdb3dbaf2..827730111f65b 100644 --- a/ext/zend_test/tests/observer_call_user_func_03.phpt +++ b/ext/zend_test/tests/observer_call_user_func_03.phpt @@ -26,11 +26,6 @@ namespace Test { } ?> --EXPECTF-- -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_call_user_func_04.phpt b/ext/zend_test/tests/observer_call_user_func_04.phpt index a28695ede592a..7f516002aeff7 100644 --- a/ext/zend_test/tests/observer_call_user_func_04.phpt +++ b/ext/zend_test/tests/observer_call_user_func_04.phpt @@ -26,11 +26,6 @@ namespace Test { } ?> --EXPECTF-- -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_closure_01.phpt b/ext/zend_test/tests/observer_closure_01.phpt index 7b41765a76d4f..c10b170337bf4 100644 --- a/ext/zend_test/tests/observer_closure_01.phpt +++ b/ext/zend_test/tests/observer_closure_01.phpt @@ -23,11 +23,6 @@ $foo($bar); echo 'DONE' . PHP_EOL; ?> --EXPECTF-- -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_closure_02.phpt b/ext/zend_test/tests/observer_closure_02.phpt index 5c98e9a7ab47c..e9724405647cd 100644 --- a/ext/zend_test/tests/observer_closure_02.phpt +++ b/ext/zend_test/tests/observer_closure_02.phpt @@ -22,11 +22,6 @@ $closure(); echo 'DONE' . PHP_EOL; ?> --EXPECTF-- -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_error_01.phpt b/ext/zend_test/tests/observer_error_01.phpt index 9672361e1cf38..534e484c8a04c 100644 --- a/ext/zend_test/tests/observer_error_01.phpt +++ b/ext/zend_test/tests/observer_error_01.phpt @@ -19,11 +19,6 @@ foo(); echo 'You should not see this.'; ?> --EXPECTF-- -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_error_02.phpt b/ext/zend_test/tests/observer_error_02.phpt index c9e22d3543680..426c345e75045 100644 --- a/ext/zend_test/tests/observer_error_02.phpt +++ b/ext/zend_test/tests/observer_error_02.phpt @@ -18,11 +18,6 @@ foo(); echo 'You should not see this.'; ?> --EXPECTF-- -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_error_03.phpt b/ext/zend_test/tests/observer_error_03.phpt index e1b00f9cbf2ef..b9f5ae75cc0d9 100644 --- a/ext/zend_test/tests/observer_error_03.phpt +++ b/ext/zend_test/tests/observer_error_03.phpt @@ -24,11 +24,6 @@ main(); echo 'Done.' . PHP_EOL; ?> --EXPECTF-- -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_error_04.phpt b/ext/zend_test/tests/observer_error_04.phpt index 6b3341e15ea38..da0bc4b6c94a2 100644 --- a/ext/zend_test/tests/observer_error_04.phpt +++ b/ext/zend_test/tests/observer_error_04.phpt @@ -30,11 +30,6 @@ try { echo 'Done.' . PHP_EOL; ?> --EXPECTF-- -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_error_05.phpt b/ext/zend_test/tests/observer_error_05.phpt index 33b46d1ae6fb7..58a34096604b5 100644 --- a/ext/zend_test/tests/observer_error_05.phpt +++ b/ext/zend_test/tests/observer_error_05.phpt @@ -22,11 +22,6 @@ foo(); echo 'You should not see this.'; ?> --EXPECTF-- -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_eval_01.phpt b/ext/zend_test/tests/observer_eval_01.phpt index 2a9d840c3697d..7f9ff53acba11 100644 --- a/ext/zend_test/tests/observer_eval_01.phpt +++ b/ext/zend_test/tests/observer_eval_01.phpt @@ -11,11 +11,6 @@ echo eval("return 'Foo eval' . PHP_EOL;"); echo 'DONE' . PHP_EOL; ?> --EXPECTF-- -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_exception_01.phpt b/ext/zend_test/tests/observer_exception_01.phpt index dffaca53c0536..19e90e0ac62cc 100644 --- a/ext/zend_test/tests/observer_exception_01.phpt +++ b/ext/zend_test/tests/observer_exception_01.phpt @@ -23,11 +23,6 @@ foo(); echo 'You should not see this' . PHP_EOL; ?> --EXPECTF-- -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_fiber_01.phpt b/ext/zend_test/tests/observer_fiber_01.phpt index abc216792eca1..bd65731016093 100644 --- a/ext/zend_test/tests/observer_fiber_01.phpt +++ b/ext/zend_test/tests/observer_fiber_01.phpt @@ -19,11 +19,6 @@ $fiber->resume(); ?> --EXPECTF-- -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_fiber_02.phpt b/ext/zend_test/tests/observer_fiber_02.phpt index 088fea8b0a211..6e420ef0ea6c4 100644 --- a/ext/zend_test/tests/observer_fiber_02.phpt +++ b/ext/zend_test/tests/observer_fiber_02.phpt @@ -16,11 +16,6 @@ $fiber->start(); ?> --EXPECTF-- -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_fiber_03.phpt b/ext/zend_test/tests/observer_fiber_03.phpt index 699b7385b9d1f..67699c25ae859 100644 --- a/ext/zend_test/tests/observer_fiber_03.phpt +++ b/ext/zend_test/tests/observer_fiber_03.phpt @@ -39,11 +39,6 @@ $fiber->resume(); ?> --EXPECTF-- -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_fiber_04.phpt b/ext/zend_test/tests/observer_fiber_04.phpt index 790c2c8f8c1a0..3a72132f5b5e6 100644 --- a/ext/zend_test/tests/observer_fiber_04.phpt +++ b/ext/zend_test/tests/observer_fiber_04.phpt @@ -26,11 +26,6 @@ $fiber->resume(); ?> --EXPECTF-- -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_fiber_05.phpt b/ext/zend_test/tests/observer_fiber_05.phpt index e3536dc56c6a5..87ba3a856cad2 100644 --- a/ext/zend_test/tests/observer_fiber_05.phpt +++ b/ext/zend_test/tests/observer_fiber_05.phpt @@ -25,11 +25,6 @@ $fiber->resume(); ?> --EXPECTF-- -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_fiber_06.phpt b/ext/zend_test/tests/observer_fiber_06.phpt index 20383162706b8..5a80a8efc1c5d 100644 --- a/ext/zend_test/tests/observer_fiber_06.phpt +++ b/ext/zend_test/tests/observer_fiber_06.phpt @@ -22,11 +22,6 @@ try { ?> --EXPECTF-- -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_generator_01.phpt b/ext/zend_test/tests/observer_generator_01.phpt index 2d194b7e1cddb..f7170aad3388c 100644 --- a/ext/zend_test/tests/observer_generator_01.phpt +++ b/ext/zend_test/tests/observer_generator_01.phpt @@ -26,11 +26,6 @@ function doSomething() { echo doSomething() . PHP_EOL; ?> --EXPECTF-- -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_generator_02.phpt b/ext/zend_test/tests/observer_generator_02.phpt index 670bc0d53db6d..289cfa1f954c8 100644 --- a/ext/zend_test/tests/observer_generator_02.phpt +++ b/ext/zend_test/tests/observer_generator_02.phpt @@ -28,11 +28,6 @@ function doSomething() { echo doSomething() . PHP_EOL; ?> --EXPECTF-- -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_generator_03.phpt b/ext/zend_test/tests/observer_generator_03.phpt index 6ae67eeda6153..9022cd3345605 100644 --- a/ext/zend_test/tests/observer_generator_03.phpt +++ b/ext/zend_test/tests/observer_generator_03.phpt @@ -33,11 +33,6 @@ function doSomething() { echo doSomething() . PHP_EOL; ?> --EXPECTF-- -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_generator_04.phpt b/ext/zend_test/tests/observer_generator_04.phpt index f361fa1239fe1..46fb272162e43 100644 --- a/ext/zend_test/tests/observer_generator_04.phpt +++ b/ext/zend_test/tests/observer_generator_04.phpt @@ -33,11 +33,6 @@ function doSomething() { echo doSomething() . PHP_EOL; ?> --EXPECTF-- -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_generator_05.phpt b/ext/zend_test/tests/observer_generator_05.phpt index 9ccc8c835496e..d106be2ba6abe 100644 --- a/ext/zend_test/tests/observer_generator_05.phpt +++ b/ext/zend_test/tests/observer_generator_05.phpt @@ -26,11 +26,6 @@ function doSomething() { echo doSomething() . PHP_EOL; ?> --EXPECTF-- -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_magic_01.phpt b/ext/zend_test/tests/observer_magic_01.phpt index 749c7932ea4c2..0f89fba77f382 100644 --- a/ext/zend_test/tests/observer_magic_01.phpt +++ b/ext/zend_test/tests/observer_magic_01.phpt @@ -28,11 +28,6 @@ $test->bar(); echo 'DONE' . PHP_EOL; ?> --EXPECTF-- -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_opline_01.phpt b/ext/zend_test/tests/observer_opline_01.phpt index fa43a162caba5..35727349bb49c 100644 --- a/ext/zend_test/tests/observer_opline_01.phpt +++ b/ext/zend_test/tests/observer_opline_01.phpt @@ -20,11 +20,6 @@ echo array_sum([1,2,3]) . PHP_EOL; foo(); ?> --EXPECTF-- -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_retval_01.phpt b/ext/zend_test/tests/observer_retval_01.phpt index 4868cee36d77b..a63b0bd0efc87 100644 --- a/ext/zend_test/tests/observer_retval_01.phpt +++ b/ext/zend_test/tests/observer_retval_01.phpt @@ -19,11 +19,6 @@ foo(); // Retval unused echo 'Done' . PHP_EOL; ?> --EXPECTF-- -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_retval_02.phpt b/ext/zend_test/tests/observer_retval_02.phpt index 13f90c2dafea4..73992aa58312a 100644 --- a/ext/zend_test/tests/observer_retval_02.phpt +++ b/ext/zend_test/tests/observer_retval_02.phpt @@ -21,11 +21,6 @@ $gen->current(); echo 'Done' . PHP_EOL; ?> --EXPECTF-- -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_retval_03.phpt b/ext/zend_test/tests/observer_retval_03.phpt index 90ebcdcb0a269..247c56480b0f0 100644 --- a/ext/zend_test/tests/observer_retval_03.phpt +++ b/ext/zend_test/tests/observer_retval_03.phpt @@ -21,11 +21,6 @@ foo(); // Retval unused echo 'Done' . PHP_EOL; ?> --EXPECTF-- -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_retval_04.phpt b/ext/zend_test/tests/observer_retval_04.phpt index e0b2e39406ac6..a08a5de378ed6 100644 --- a/ext/zend_test/tests/observer_retval_04.phpt +++ b/ext/zend_test/tests/observer_retval_04.phpt @@ -31,11 +31,6 @@ bar('freed'); // Retval unused echo 'Done' . PHP_EOL; ?> --EXPECTF-- -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_retval_05.phpt b/ext/zend_test/tests/observer_retval_05.phpt index 374acc1c79c6b..7d05cb92986b0 100644 --- a/ext/zend_test/tests/observer_retval_05.phpt +++ b/ext/zend_test/tests/observer_retval_05.phpt @@ -18,11 +18,6 @@ foo(); // Retval unused echo 'Done' . PHP_EOL; ?> --EXPECTF-- -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_retval_06.phpt b/ext/zend_test/tests/observer_retval_06.phpt index da5aaa7efcff9..ffb41aac59818 100644 --- a/ext/zend_test/tests/observer_retval_06.phpt +++ b/ext/zend_test/tests/observer_retval_06.phpt @@ -19,11 +19,6 @@ foo(); // Retval unused echo 'Done' . PHP_EOL; ?> --EXPECTF-- -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_retval_07.phpt b/ext/zend_test/tests/observer_retval_07.phpt index ed798950d89d8..9c9c6246f587b 100644 --- a/ext/zend_test/tests/observer_retval_07.phpt +++ b/ext/zend_test/tests/observer_retval_07.phpt @@ -23,11 +23,6 @@ foo(); // Retval unused echo 'Done' . PHP_EOL; ?> --EXPECTF-- -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_retval_by_ref_01.phpt b/ext/zend_test/tests/observer_retval_by_ref_01.phpt index 6fd43d6d32c15..2a7b74de8a756 100644 --- a/ext/zend_test/tests/observer_retval_by_ref_01.phpt +++ b/ext/zend_test/tests/observer_retval_by_ref_01.phpt @@ -19,11 +19,6 @@ foo(); // Retval unused echo 'Done' . PHP_EOL; ?> --EXPECTF-- -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_retval_by_ref_02.phpt b/ext/zend_test/tests/observer_retval_by_ref_02.phpt index cca7ab3c637d9..b28dc704e4d6a 100644 --- a/ext/zend_test/tests/observer_retval_by_ref_02.phpt +++ b/ext/zend_test/tests/observer_retval_by_ref_02.phpt @@ -19,11 +19,6 @@ foo(); // Retval unused echo 'Done' . PHP_EOL; ?> --EXPECTF-- -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_retval_by_ref_03.phpt b/ext/zend_test/tests/observer_retval_by_ref_03.phpt index 9480fe0072e2d..9c4cd622e7da1 100644 --- a/ext/zend_test/tests/observer_retval_by_ref_03.phpt +++ b/ext/zend_test/tests/observer_retval_by_ref_03.phpt @@ -23,11 +23,6 @@ foo(); // Retval unused echo 'Done' . PHP_EOL; ?> --EXPECTF-- -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_shutdown_01.phpt b/ext/zend_test/tests/observer_shutdown_01.phpt index ebf24adeceeb6..837d0f7f2b7d2 100644 --- a/ext/zend_test/tests/observer_shutdown_01.phpt +++ b/ext/zend_test/tests/observer_shutdown_01.phpt @@ -24,11 +24,6 @@ function foo() { echo 'Done: ' . bar(40) . PHP_EOL; ?> --EXPECTF-- -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_shutdown_02.phpt b/ext/zend_test/tests/observer_shutdown_02.phpt index 7fd414752f630..f3fbce36dfb8a 100644 --- a/ext/zend_test/tests/observer_shutdown_02.phpt +++ b/ext/zend_test/tests/observer_shutdown_02.phpt @@ -30,11 +30,6 @@ $mc = new MyClass(); echo 'Done: ' . bar(40) . PHP_EOL; ?> --EXPECTF-- -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_types_01.phpt b/ext/zend_test/tests/observer_types_01.phpt index 4cc059639d053..7176ab32b494e 100644 --- a/ext/zend_test/tests/observer_types_01.phpt +++ b/ext/zend_test/tests/observer_types_01.phpt @@ -12,11 +12,6 @@ function foo(array $a) { return 1; } foo(42); ?> --EXPECTF-- -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/observer_zend_call_function_01.phpt b/ext/zend_test/tests/observer_zend_call_function_01.phpt index 2ade33bf89373..e148c9b20bd09 100644 --- a/ext/zend_test/tests/observer_zend_call_function_01.phpt +++ b/ext/zend_test/tests/observer_zend_call_function_01.phpt @@ -18,11 +18,6 @@ var_dump(array_reduce($a, 'sum')); echo 'Done' . PHP_EOL; ?> --EXPECTF-- -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 diff --git a/ext/zend_test/tests/optimizer_register_pass.phpt b/ext/zend_test/tests/optimizer_register_pass.phpt index b6878b948971c..50499344c4709 100644 --- a/ext/zend_test/tests/optimizer_register_pass.phpt +++ b/ext/zend_test/tests/optimizer_register_pass.phpt @@ -22,10 +22,5 @@ zend_test.register_passes=1 ?> --EXPECT-- -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 pass1 pass2 diff --git a/ext/zend_test/tests/zend_legacy_iterable.phpt b/ext/zend_test/tests/zend_legacy_iterable.phpt index 1316a095f6893..e9ca8e2f1cc61 100644 --- a/ext/zend_test/tests/zend_legacy_iterable.phpt +++ b/ext/zend_test/tests/zend_legacy_iterable.phpt @@ -1,5 +1,10 @@ --TEST-- Test that legacy IS_ITERABLE arg info type generates a notice +--SKIPIF-- + --EXPECT-- -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 string(3) "php" #!/path/to/php string(3) "php" diff --git a/ext/zend_test/tests/zend_weakmap.phpt b/ext/zend_test/tests/zend_weakmap.phpt index 0cbc094ee799a..209b8bc0e0906 100644 --- a/ext/zend_test/tests/zend_weakmap.phpt +++ b/ext/zend_test/tests/zend_weakmap.phpt @@ -29,11 +29,6 @@ var_dump(zend_weakmap_dump()); ?> --EXPECTF-- -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 bool(true) bool(false) bool(true) From cc0291cda2f3d607eb3b787c2af3451fc5ac4256 Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Tue, 3 May 2022 22:53:09 +0100 Subject: [PATCH 21/28] Do not warn but enable legacy cnbversion test --- Zend/zend_API.c | 2 ++ ext/zend_test/test.c | 3 +-- ext/zend_test/tests/zend_legacy_iterable.phpt | 10 ---------- 3 files changed, 3 insertions(+), 12 deletions(-) diff --git a/Zend/zend_API.c b/Zend/zend_API.c index 053b65494be12..adacdf3affffb 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -2865,8 +2865,10 @@ ZEND_API zend_result zend_register_functions(zend_class_entry *scope, const zend } } if (ZEND_TYPE_IS_ITERABLE_FALLBACK(new_arg_info[i].type)) { + /* Do not warn? zend_error(E_CORE_WARNING, "iterable type is now a compile time alias for array|Traversable," " regenerate the argument info via the php-src gen_stub build script"); + */ zend_type legacy_iterable = ZEND_TYPE_INIT_CLASS_CONST_MASK(ZSTR_KNOWN(ZEND_STR_TRAVERSABLE), (new_arg_info[i].type.type_mask|_ZEND_TYPE_UNION_BIT|MAY_BE_ARRAY)); memcpy(&new_arg_info[i].type, &legacy_iterable, sizeof(zend_type)); diff --git a/ext/zend_test/test.c b/ext/zend_test/test.c index 15950c709342b..2fbabe7ef647b 100644 --- a/ext/zend_test/test.c +++ b/ext/zend_test/test.c @@ -651,8 +651,7 @@ PHP_MINIT_FUNCTION(zend_test) zend_test_string_enum = register_class_ZendTestStringEnum(); zend_test_int_enum = register_class_ZendTestIntEnum(); - /* Register legacy iterable function, this generates E_CORE_WARNING on startup */ - //zend_register_functions(NULL, ext_function_legacy, NULL, EG(current_module)->type); + zend_register_functions(NULL, ext_function_legacy, NULL, EG(current_module)->type); // Loading via dl() not supported with the observer API if (type != MODULE_TEMPORARY) { diff --git a/ext/zend_test/tests/zend_legacy_iterable.phpt b/ext/zend_test/tests/zend_legacy_iterable.phpt index e9ca8e2f1cc61..73bbb269c2679 100644 --- a/ext/zend_test/tests/zend_legacy_iterable.phpt +++ b/ext/zend_test/tests/zend_legacy_iterable.phpt @@ -1,10 +1,5 @@ --TEST-- Test that legacy IS_ITERABLE arg info type generates a notice ---SKIPIF-- - ==DONE== --EXPECT-- -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 - -Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0 array(0) { } array(0) { From bbdb79313f8d2d06d4af9ff79593587707fd9be8 Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Fri, 20 May 2022 13:57:26 +0100 Subject: [PATCH 22/28] Reflection iterable BC for named types --- ext/reflection/php_reflection.c | 31 +++++-- ext/reflection/tests/bug72661.phpt | 10 --- ext/reflection/tests/iterable_Reflection.phpt | 89 ++++++++++++++++--- 3 files changed, 101 insertions(+), 29 deletions(-) delete mode 100644 ext/reflection/tests/bug72661.phpt diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index be12712c2abb0..cc31eb974bb91 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -1330,7 +1330,7 @@ typedef enum { } reflection_type_kind; /* For backwards compatibility reasons, we need to return T|null style unions - * ~~and transformation from iterable to Traversable|array~~ + * and transformation from iterable to Traversable|array * as a ReflectionNamedType. Here we determine what counts as a union type and * what doesn't. */ static reflection_type_kind get_type_kind(zend_type type) { @@ -1346,11 +1346,9 @@ static reflection_type_kind get_type_kind(zend_type type) { if (ZEND_TYPE_IS_COMPLEX(type)) { /* BC support for 'iterable' type */ - /* if (UNEXPECTED(ZEND_TYPE_IS_ITERABLE_FALLBACK(type))) { return NAMED_TYPE; } - */ if (type_mask_without_null != 0) { return UNION_TYPE; } @@ -3018,9 +3016,21 @@ ZEND_METHOD(ReflectionType, allowsNull) } /* }}} */ +/* For BC with iterable for named types */ +static zend_string *zend_named_reflection_type_to_string(zend_type type) { + if (ZEND_TYPE_IS_ITERABLE_FALLBACK(type)) { + zend_string *iterable = ZSTR_KNOWN(ZEND_STR_ITERABLE); + if (ZEND_TYPE_FULL_MASK(type) & MAY_BE_NULL) { + return zend_string_concat2("?", strlen("?"), ZSTR_VAL(iterable), ZSTR_LEN(iterable)); + } + return iterable; + } + return zend_type_to_string(type); +} + static zend_string *zend_type_to_string_without_null(zend_type type) { ZEND_TYPE_FULL_MASK(type) &= ~MAY_BE_NULL; - return zend_type_to_string(type); + return zend_named_reflection_type_to_string(type); } /* {{{ Return the text of the type hint */ @@ -3034,7 +3044,7 @@ ZEND_METHOD(ReflectionType, __toString) } GET_REFLECTION_OBJECT_PTR(param); - RETURN_STR(zend_type_to_string(param->type)); + RETURN_STR(zend_named_reflection_type_to_string(param->type)); } /* }}} */ @@ -3052,7 +3062,7 @@ ZEND_METHOD(ReflectionNamedType, getName) if (param->legacy_behavior) { RETURN_STR(zend_type_to_string_without_null(param->type)); } - RETURN_STR(zend_type_to_string(param->type)); + RETURN_STR(zend_named_reflection_type_to_string(param->type)); } /* }}} */ @@ -3067,6 +3077,10 @@ ZEND_METHOD(ReflectionNamedType, isBuiltin) } GET_REFLECTION_OBJECT_PTR(param); + if (ZEND_TYPE_IS_ITERABLE_FALLBACK(param->type)) { + RETURN_TRUE; + } + /* Treat "static" as a class type for the purposes of reflection. */ RETVAL_BOOL(ZEND_TYPE_IS_ONLY_MASK(param->type) && !(ZEND_TYPE_FULL_MASK(param->type) & MAY_BE_STATIC)); @@ -3075,6 +3089,11 @@ ZEND_METHOD(ReflectionNamedType, isBuiltin) static void append_type(zval *return_value, zend_type type) { zval reflection_type; + /* Drop iterable BC bit for type list */ + if (ZEND_TYPE_IS_ITERABLE_FALLBACK(type)) { + ZEND_TYPE_FULL_MASK(type) &= ~_ZEND_TYPE_ITERABLE_BIT; + } + reflection_type_factory(type, &reflection_type, 0); zend_hash_next_index_insert(Z_ARRVAL_P(return_value), &reflection_type); } diff --git a/ext/reflection/tests/bug72661.phpt b/ext/reflection/tests/bug72661.phpt deleted file mode 100644 index b07db2f37b582..0000000000000 --- a/ext/reflection/tests/bug72661.phpt +++ /dev/null @@ -1,10 +0,0 @@ ---TEST-- -Bug #72661 (ReflectionType::__toString crashes with iterable) ---FILE-- -getType()); -?> ---EXPECT-- -string(17) "Traversable|array" diff --git a/ext/reflection/tests/iterable_Reflection.phpt b/ext/reflection/tests/iterable_Reflection.phpt index 9a67481121b84..0a8a30a6dd0c4 100644 --- a/ext/reflection/tests/iterable_Reflection.phpt +++ b/ext/reflection/tests/iterable_Reflection.phpt @@ -3,33 +3,96 @@ iterable Type in Reflection --FILE-- getType(); +var_dump($paramType::class); +var_dump($paramType); +var_dump($paramType->getName()); +var_dump((string) $paramType); +var_dump($paramType->isBuiltin()); $reflectionFunc = new ReflectionFunction($function); $returnType = $reflectionFunc->getReturnType(); var_dump($returnType::class); -foreach ($returnType->getTypes() as $type) { - var_dump($type->getName()); -} +var_dump($returnType); +var_dump($returnType->getName()); +var_dump((string) $returnType); +var_dump($returnType->isBuiltin()); class PropIterableTypeTest { public iterable $iterable; + public ?iterable $nullableIterable; + public array $control; + public ?array $nullableControl; } $reflector = new ReflectionClass(PropIterableTypeTest::class); -[$property] = $reflector->getProperties(); +[$property, $nullable, $control, $nullableControl] = $reflector->getProperties(); $iterableType = $property->getType(); var_dump($iterableType::class); -foreach ($iterableType->getTypes() as $type) { - var_dump($type->getName()); -} +var_dump($iterableType); +var_dump($iterableType->getName()); +var_dump((string) $iterableType); +var_dump($iterableType->isBuiltin()); + +$nullableIterableType = $nullable->getType(); +var_dump($nullableIterableType::class); +var_dump($nullableIterableType); +var_dump($nullableIterableType->getName()); +var_dump((string) $nullableIterableType); +var_dump($nullableIterableType->isBuiltin()); + +$controlType = $control->getType(); +var_dump($controlType::class); +var_dump($controlType); +var_dump($controlType->getName()); +var_dump((string) $controlType); +var_dump($controlType->isBuiltin()); + +$nullableControlType = $nullableControl->getType(); +var_dump($nullableControlType::class); +var_dump($nullableControlType); +var_dump($nullableControlType->getName()); +var_dump((string) $nullableControlType); +var_dump($nullableControlType->isBuiltin()); ?> ---EXPECT-- -string(19) "ReflectionUnionType" -string(11) "Traversable" +--EXPECTF-- +string(19) "ReflectionNamedType" +object(ReflectionNamedType)#%d (0) { +} +string(8) "iterable" +string(8) "iterable" +bool(true) +string(19) "ReflectionNamedType" +object(ReflectionNamedType)#%d (0) { +} +string(8) "iterable" +string(8) "iterable" +bool(true) +string(19) "ReflectionNamedType" +object(ReflectionNamedType)#%d (0) { +} +string(8) "iterable" +string(8) "iterable" +bool(true) +string(19) "ReflectionNamedType" +object(ReflectionNamedType)#%d (0) { +} +string(8) "iterable" +string(9) "?iterable" +bool(true) +string(19) "ReflectionNamedType" +object(ReflectionNamedType)#%d (0) { +} +string(5) "array" string(5) "array" -string(19) "ReflectionUnionType" -string(11) "Traversable" +bool(true) +string(19) "ReflectionNamedType" +object(ReflectionNamedType)#%d (0) { +} string(5) "array" +string(6) "?array" +bool(true) From be441750e4c0c06066e05032db4211cc7189bdbe Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Fri, 20 May 2022 14:13:08 +0100 Subject: [PATCH 23/28] Nit + whitespaces --- Zend/zend_API.c | 48 ++++++++++++++++----------------- ext/reflection/php_reflection.c | 2 +- 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/Zend/zend_API.c b/Zend/zend_API.c index adacdf3affffb..2f5eac900835e 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -1549,8 +1549,8 @@ ZEND_API void object_properties_init_ex(zend_object *object, HashTable *properti ZEND_HASH_MAP_FOREACH_STR_KEY_VAL(properties, key, prop) { property_info = zend_get_property_info(object->ce, key, 1); if (property_info != ZEND_WRONG_PROPERTY_INFO && - property_info && - (property_info->flags & ZEND_ACC_STATIC) == 0) { + property_info && + (property_info->flags & ZEND_ACC_STATIC) == 0) { zval *slot = OBJ_PROP(object, property_info->offset); if (UNEXPECTED(ZEND_TYPE_IS_SET(property_info->type))) { @@ -2275,7 +2275,7 @@ ZEND_API void zend_collect_module_handlers(void) /* {{{ */ } } ZEND_HASH_FOREACH_END(); module_request_startup_handlers = (zend_module_entry**)malloc( - sizeof(zend_module_entry*) * + sizeof(zend_module_entry*) * (startup_count + 1 + shutdown_count + 1 + post_deactivate_count + 1)); @@ -2301,8 +2301,8 @@ ZEND_API void zend_collect_module_handlers(void) /* {{{ */ /* Collect internal classes with static members */ ZEND_HASH_MAP_FOREACH_PTR(CG(class_table), ce) { if (ce->type == ZEND_INTERNAL_CLASS && - ce->default_static_members_count > 0) { - class_count++; + ce->default_static_members_count > 0) { + class_count++; } } ZEND_HASH_FOREACH_END(); @@ -2314,8 +2314,8 @@ ZEND_API void zend_collect_module_handlers(void) /* {{{ */ if (class_count) { ZEND_HASH_MAP_FOREACH_PTR(CG(class_table), ce) { if (ce->type == ZEND_INTERNAL_CLASS && - ce->default_static_members_count > 0) { - class_cleanup_handlers[--class_count] = ce; + ce->default_static_members_count > 0) { + class_cleanup_handlers[--class_count] = ce; } } ZEND_HASH_FOREACH_END(); } @@ -2795,7 +2795,7 @@ ZEND_API zend_result zend_register_functions(zend_class_entry *scope, const zend if (ZEND_TYPE_IS_ITERABLE_FALLBACK(arg_info->type)) { rebuild_arginfo = true; } - reg_function->common.fn_flags |= ZEND_ACC_HAS_TYPE_HINTS; + reg_function->common.fn_flags |= ZEND_ACC_HAS_TYPE_HINTS; } #if ZEND_DEBUG for (uint32_t j = 0; j < i; j++) { @@ -2810,7 +2810,7 @@ ZEND_API zend_result zend_register_functions(zend_class_entry *scope, const zend } if (reg_function->common.arg_info && - (reg_function->common.fn_flags & (ZEND_ACC_HAS_RETURN_TYPE|ZEND_ACC_HAS_TYPE_HINTS))) { + (reg_function->common.fn_flags & (ZEND_ACC_HAS_RETURN_TYPE|ZEND_ACC_HAS_TYPE_HINTS))) { /* Treat return type as an extra argument */ num_args++; rebuild_arginfo = true; @@ -3449,8 +3449,8 @@ static bool zend_is_callable_check_class(zend_string *name, zend_class_entry *sc zend_object *object = zend_get_this_object(frame); if (object && - instanceof_function(object->ce, scope) && - instanceof_function(scope, ce)) { + instanceof_function(object->ce, scope) && + instanceof_function(scope, ce)) { fcc->object = object; fcc->called_scope = object->ce; } else { @@ -3555,8 +3555,8 @@ static zend_always_inline bool zend_is_callable_check_func(zval *callable, zend_ zend_object *object = zend_get_this_object(frame); if (object && - instanceof_function(object->ce, scope) && - instanceof_function(scope, fcc->calling_scope)) { + instanceof_function(object->ce, scope) && + instanceof_function(scope, fcc->calling_scope)) { fcc->object = object; fcc->called_scope = object->ce; } else { @@ -3599,7 +3599,7 @@ static zend_always_inline bool zend_is_callable_check_func(zval *callable, zend_ lmname = zend_string_tolower(mname); if (strict_class && - fcc->calling_scope && + fcc->calling_scope && zend_string_equals_literal(lmname, ZEND_CONSTRUCTOR_FUNC_NAME)) { fcc->function_handler = fcc->calling_scope->constructor; if (fcc->function_handler) { @@ -3609,10 +3609,10 @@ static zend_always_inline bool zend_is_callable_check_func(zval *callable, zend_ fcc->function_handler = Z_PTR_P(zv); retval = 1; if ((fcc->function_handler->op_array.fn_flags & ZEND_ACC_CHANGED) && - !strict_class) { + !strict_class) { scope = get_scope(frame); if (scope && - instanceof_function(fcc->function_handler->common.scope, scope)) { + instanceof_function(fcc->function_handler->common.scope, scope)) { zv = zend_hash_find(&scope->function_table, lmname); if (zv != NULL) { @@ -3626,9 +3626,9 @@ static zend_always_inline bool zend_is_callable_check_func(zval *callable, zend_ } } if (!(fcc->function_handler->common.fn_flags & ZEND_ACC_PUBLIC) && - (fcc->calling_scope && - ((fcc->object && fcc->calling_scope->__call) || - (!fcc->object && fcc->calling_scope->__callstatic)))) { + (fcc->calling_scope && + ((fcc->object && fcc->calling_scope->__call) || + (!fcc->object && fcc->calling_scope->__callstatic)))) { scope = get_scope(frame); if (fcc->function_handler->common.scope != scope) { if ((fcc->function_handler->common.fn_flags & ZEND_ACC_PRIVATE) @@ -3650,8 +3650,8 @@ static zend_always_inline bool zend_is_callable_check_func(zval *callable, zend_ fcc->function_handler = fcc->object->handlers->get_method(&fcc->object, mname, NULL); if (fcc->function_handler) { if (strict_class && - (!fcc->function_handler->common.scope || - !instanceof_function(ce_org, fcc->function_handler->common.scope))) { + (!fcc->function_handler->common.scope || + !instanceof_function(ce_org, fcc->function_handler->common.scope))) { zend_release_fcall_info_cache(fcc); } else { retval = 1; @@ -3671,7 +3671,7 @@ static zend_always_inline bool zend_is_callable_check_func(zval *callable, zend_ if (call_via_handler && !fcc->object) { zend_object *object = zend_get_this_object(frame); if (object && - instanceof_function(object->ce, fcc->calling_scope)) { + instanceof_function(object->ce, fcc->calling_scope)) { fcc->object = object; } } @@ -4140,7 +4140,7 @@ ZEND_API zend_property_info *zend_declare_typed_property(zend_class_entry *ce, z } if (access_type & ZEND_ACC_STATIC) { if ((property_info_ptr = zend_hash_find_ptr(&ce->properties_info, name)) != NULL && - (property_info_ptr->flags & ZEND_ACC_STATIC) != 0) { + (property_info_ptr->flags & ZEND_ACC_STATIC) != 0) { property_info->offset = property_info_ptr->offset; zval_ptr_dtor(&ce->default_static_members_table[property_info->offset]); zend_hash_del(&ce->properties_info, name); @@ -4158,7 +4158,7 @@ ZEND_API zend_property_info *zend_declare_typed_property(zend_class_entry *ce, z } else { zval *property_default_ptr; if ((property_info_ptr = zend_hash_find_ptr(&ce->properties_info, name)) != NULL && - (property_info_ptr->flags & ZEND_ACC_STATIC) == 0) { + (property_info_ptr->flags & ZEND_ACC_STATIC) == 0) { property_info->offset = property_info_ptr->offset; zval_ptr_dtor(&ce->default_properties_table[OBJ_PROP_TO_NUM(property_info->offset)]); zend_hash_del(&ce->properties_info, name); diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index cc31eb974bb91..5c9bcc731b475 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -3137,7 +3137,7 @@ ZEND_METHOD(ReflectionUnionType, getTypes) if (type_mask & MAY_BE_OBJECT) { append_type_mask(return_value, MAY_BE_OBJECT); } - if ((type_mask & MAY_BE_ARRAY)) { + if (type_mask & MAY_BE_ARRAY) { append_type_mask(return_value, MAY_BE_ARRAY); } if (type_mask & MAY_BE_STRING) { From e0bf71bbeca03d5c2d92010331e63548733a60ed Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Fri, 27 May 2022 14:30:22 +0100 Subject: [PATCH 24/28] Address review comments Clarify comment Remove unnecessary variable Use ZEND_TYPE_INIT_CLASS_CONST_MASK in zend_compile.c --- Zend/zend_API.c | 11 ++--------- Zend/zend_compile.c | 8 ++------ 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/Zend/zend_API.c b/Zend/zend_API.c index 2f5eac900835e..f5223463e2900 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -2784,7 +2784,6 @@ ZEND_API zend_result zend_register_functions(zend_class_entry *scope, const zend num_args++; } - bool rebuild_arginfo = false; /* If types of arguments have to be checked */ if (reg_function->common.arg_info && num_args) { uint32_t i; @@ -2792,9 +2791,6 @@ ZEND_API zend_result zend_register_functions(zend_class_entry *scope, const zend zend_internal_arg_info *arg_info = ®_function->internal_function.arg_info[i]; ZEND_ASSERT(arg_info->name && "Parameter must have a name"); if (ZEND_TYPE_IS_SET(arg_info->type)) { - if (ZEND_TYPE_IS_ITERABLE_FALLBACK(arg_info->type)) { - rebuild_arginfo = true; - } reg_function->common.fn_flags |= ZEND_ACC_HAS_TYPE_HINTS; } #if ZEND_DEBUG @@ -2809,14 +2805,11 @@ ZEND_API zend_result zend_register_functions(zend_class_entry *scope, const zend } } + /* Rebuild arginfos if parameter/property types and/or a return type are used */ if (reg_function->common.arg_info && (reg_function->common.fn_flags & (ZEND_ACC_HAS_RETURN_TYPE|ZEND_ACC_HAS_TYPE_HINTS))) { /* Treat return type as an extra argument */ num_args++; - rebuild_arginfo = true; - } - - if (rebuild_arginfo) { /* convert "const char*" class type names into "zend_string*" */ uint32_t i; zend_arg_info *arg_info = reg_function->common.arg_info - 1; @@ -2865,7 +2858,7 @@ ZEND_API zend_result zend_register_functions(zend_class_entry *scope, const zend } } if (ZEND_TYPE_IS_ITERABLE_FALLBACK(new_arg_info[i].type)) { - /* Do not warn? + /* Warning generated an extension load warning which is emitted for every test zend_error(E_CORE_WARNING, "iterable type is now a compile time alias for array|Traversable," " regenerate the argument info via the php-src gen_stub build script"); */ diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 66fc39bd175d6..69b7052e73fcd 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -6146,13 +6146,9 @@ static zend_type zend_compile_single_typename(zend_ast *ast) /* Transform iterable into a type union alias */ if (type_code == IS_ITERABLE) { - zend_type iterable = (zend_type) ZEND_TYPE_INIT_CLASS(ZSTR_KNOWN(ZEND_STR_TRAVERSABLE), 0, 0); - ZEND_TYPE_FULL_MASK(iterable) |= MAY_BE_ARRAY; - // TODO Use this instead? ZEND_TYPE_INIT_CLASS_CONST_MASK(ZSTR_KNOWN(ZEND_STR_TRAVERSABLE), MAY_BE_ARRAY); /* Set iterable bit for BC compat during Reflection and string representation of type */ - ZEND_TYPE_FULL_MASK(iterable) |= _ZEND_TYPE_ITERABLE_BIT; - /* Inform that the type list is a union type */ - ZEND_TYPE_FULL_MASK(iterable) |= _ZEND_TYPE_UNION_BIT; + zend_type iterable = (zend_type) ZEND_TYPE_INIT_CLASS_CONST_MASK(ZSTR_KNOWN(ZEND_STR_TRAVERSABLE), + (_ZEND_TYPE_UNION_BIT|MAY_BE_ARRAY|_ZEND_TYPE_ITERABLE_BIT)); return iterable; } From 78129bd49299c7fe9d475c51a8aa0ca44714509d Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Mon, 30 May 2022 12:41:30 +0100 Subject: [PATCH 25/28] Whitespace revert + code move revert --- Zend/zend_API.c | 52 ++++++++++++++++++++++++------------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/Zend/zend_API.c b/Zend/zend_API.c index f5223463e2900..a0d39a99e64ce 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -1549,8 +1549,8 @@ ZEND_API void object_properties_init_ex(zend_object *object, HashTable *properti ZEND_HASH_MAP_FOREACH_STR_KEY_VAL(properties, key, prop) { property_info = zend_get_property_info(object->ce, key, 1); if (property_info != ZEND_WRONG_PROPERTY_INFO && - property_info && - (property_info->flags & ZEND_ACC_STATIC) == 0) { + property_info && + (property_info->flags & ZEND_ACC_STATIC) == 0) { zval *slot = OBJ_PROP(object, property_info->offset); if (UNEXPECTED(ZEND_TYPE_IS_SET(property_info->type))) { @@ -2275,7 +2275,7 @@ ZEND_API void zend_collect_module_handlers(void) /* {{{ */ } } ZEND_HASH_FOREACH_END(); module_request_startup_handlers = (zend_module_entry**)malloc( - sizeof(zend_module_entry*) * + sizeof(zend_module_entry*) * (startup_count + 1 + shutdown_count + 1 + post_deactivate_count + 1)); @@ -2301,8 +2301,8 @@ ZEND_API void zend_collect_module_handlers(void) /* {{{ */ /* Collect internal classes with static members */ ZEND_HASH_MAP_FOREACH_PTR(CG(class_table), ce) { if (ce->type == ZEND_INTERNAL_CLASS && - ce->default_static_members_count > 0) { - class_count++; + ce->default_static_members_count > 0) { + class_count++; } } ZEND_HASH_FOREACH_END(); @@ -2314,8 +2314,8 @@ ZEND_API void zend_collect_module_handlers(void) /* {{{ */ if (class_count) { ZEND_HASH_MAP_FOREACH_PTR(CG(class_table), ce) { if (ce->type == ZEND_INTERNAL_CLASS && - ce->default_static_members_count > 0) { - class_cleanup_handlers[--class_count] = ce; + ce->default_static_members_count > 0) { + class_cleanup_handlers[--class_count] = ce; } } ZEND_HASH_FOREACH_END(); } @@ -2791,7 +2791,7 @@ ZEND_API zend_result zend_register_functions(zend_class_entry *scope, const zend zend_internal_arg_info *arg_info = ®_function->internal_function.arg_info[i]; ZEND_ASSERT(arg_info->name && "Parameter must have a name"); if (ZEND_TYPE_IS_SET(arg_info->type)) { - reg_function->common.fn_flags |= ZEND_ACC_HAS_TYPE_HINTS; + reg_function->common.fn_flags |= ZEND_ACC_HAS_TYPE_HINTS; } #if ZEND_DEBUG for (uint32_t j = 0; j < i; j++) { @@ -2807,14 +2807,14 @@ ZEND_API zend_result zend_register_functions(zend_class_entry *scope, const zend /* Rebuild arginfos if parameter/property types and/or a return type are used */ if (reg_function->common.arg_info && - (reg_function->common.fn_flags & (ZEND_ACC_HAS_RETURN_TYPE|ZEND_ACC_HAS_TYPE_HINTS))) { - /* Treat return type as an extra argument */ - num_args++; + (reg_function->common.fn_flags & (ZEND_ACC_HAS_RETURN_TYPE|ZEND_ACC_HAS_TYPE_HINTS))) { /* convert "const char*" class type names into "zend_string*" */ uint32_t i; zend_arg_info *arg_info = reg_function->common.arg_info - 1; zend_arg_info *new_arg_info; + /* Treat return type as an extra argument */ + num_args++; new_arg_info = malloc(sizeof(zend_arg_info) * num_args); memcpy(new_arg_info, arg_info, sizeof(zend_arg_info) * num_args); reg_function->common.arg_info = new_arg_info + 1; @@ -3432,8 +3432,8 @@ static bool zend_is_callable_check_class(zend_string *name, zend_class_entry *sc if (!fcc->object) { fcc->object = zend_get_this_object(frame); } - *strict_class = 1; - ret = 1; + *strict_class = 1; + ret = 1; } } else if ((ce = zend_lookup_class(name)) != NULL) { zend_class_entry *scope = get_scope(frame); @@ -3548,8 +3548,8 @@ static zend_always_inline bool zend_is_callable_check_func(zval *callable, zend_ zend_object *object = zend_get_this_object(frame); if (object && - instanceof_function(object->ce, scope) && - instanceof_function(scope, fcc->calling_scope)) { + instanceof_function(object->ce, scope) && + instanceof_function(scope, fcc->calling_scope)) { fcc->object = object; fcc->called_scope = object->ce; } else { @@ -3592,7 +3592,7 @@ static zend_always_inline bool zend_is_callable_check_func(zval *callable, zend_ lmname = zend_string_tolower(mname); if (strict_class && - fcc->calling_scope && + fcc->calling_scope && zend_string_equals_literal(lmname, ZEND_CONSTRUCTOR_FUNC_NAME)) { fcc->function_handler = fcc->calling_scope->constructor; if (fcc->function_handler) { @@ -3602,10 +3602,10 @@ static zend_always_inline bool zend_is_callable_check_func(zval *callable, zend_ fcc->function_handler = Z_PTR_P(zv); retval = 1; if ((fcc->function_handler->op_array.fn_flags & ZEND_ACC_CHANGED) && - !strict_class) { + !strict_class) { scope = get_scope(frame); if (scope && - instanceof_function(fcc->function_handler->common.scope, scope)) { + instanceof_function(fcc->function_handler->common.scope, scope)) { zv = zend_hash_find(&scope->function_table, lmname); if (zv != NULL) { @@ -3619,9 +3619,9 @@ static zend_always_inline bool zend_is_callable_check_func(zval *callable, zend_ } } if (!(fcc->function_handler->common.fn_flags & ZEND_ACC_PUBLIC) && - (fcc->calling_scope && - ((fcc->object && fcc->calling_scope->__call) || - (!fcc->object && fcc->calling_scope->__callstatic)))) { + (fcc->calling_scope && + ((fcc->object && fcc->calling_scope->__call) || + (!fcc->object && fcc->calling_scope->__callstatic)))) { scope = get_scope(frame); if (fcc->function_handler->common.scope != scope) { if ((fcc->function_handler->common.fn_flags & ZEND_ACC_PRIVATE) @@ -3643,8 +3643,8 @@ static zend_always_inline bool zend_is_callable_check_func(zval *callable, zend_ fcc->function_handler = fcc->object->handlers->get_method(&fcc->object, mname, NULL); if (fcc->function_handler) { if (strict_class && - (!fcc->function_handler->common.scope || - !instanceof_function(ce_org, fcc->function_handler->common.scope))) { + (!fcc->function_handler->common.scope || + !instanceof_function(ce_org, fcc->function_handler->common.scope))) { zend_release_fcall_info_cache(fcc); } else { retval = 1; @@ -3664,7 +3664,7 @@ static zend_always_inline bool zend_is_callable_check_func(zval *callable, zend_ if (call_via_handler && !fcc->object) { zend_object *object = zend_get_this_object(frame); if (object && - instanceof_function(object->ce, fcc->calling_scope)) { + instanceof_function(object->ce, fcc->calling_scope)) { fcc->object = object; } } @@ -4133,7 +4133,7 @@ ZEND_API zend_property_info *zend_declare_typed_property(zend_class_entry *ce, z } if (access_type & ZEND_ACC_STATIC) { if ((property_info_ptr = zend_hash_find_ptr(&ce->properties_info, name)) != NULL && - (property_info_ptr->flags & ZEND_ACC_STATIC) != 0) { + (property_info_ptr->flags & ZEND_ACC_STATIC) != 0) { property_info->offset = property_info_ptr->offset; zval_ptr_dtor(&ce->default_static_members_table[property_info->offset]); zend_hash_del(&ce->properties_info, name); @@ -4151,7 +4151,7 @@ ZEND_API zend_property_info *zend_declare_typed_property(zend_class_entry *ce, z } else { zval *property_default_ptr; if ((property_info_ptr = zend_hash_find_ptr(&ce->properties_info, name)) != NULL && - (property_info_ptr->flags & ZEND_ACC_STATIC) == 0) { + (property_info_ptr->flags & ZEND_ACC_STATIC) == 0) { property_info->offset = property_info_ptr->offset; zval_ptr_dtor(&ce->default_properties_table[OBJ_PROP_TO_NUM(property_info->offset)]); zend_hash_del(&ce->properties_info, name); From ae53b045f735c9a89f0e23ae8f5a2d3a47326905 Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Mon, 30 May 2022 12:43:11 +0100 Subject: [PATCH 26/28] Do not memcpy when not needed --- Zend/zend_API.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Zend/zend_API.c b/Zend/zend_API.c index a0d39a99e64ce..821f35ee6de4e 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -2864,7 +2864,7 @@ ZEND_API zend_result zend_register_functions(zend_class_entry *scope, const zend */ zend_type legacy_iterable = ZEND_TYPE_INIT_CLASS_CONST_MASK(ZSTR_KNOWN(ZEND_STR_TRAVERSABLE), (new_arg_info[i].type.type_mask|_ZEND_TYPE_UNION_BIT|MAY_BE_ARRAY)); - memcpy(&new_arg_info[i].type, &legacy_iterable, sizeof(zend_type)); + new_arg_info[i].type = legacy_iterable; } } } From d4056a9d8282a77ef54e79c5b22eeeb30c508789 Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Mon, 30 May 2022 13:01:15 +0100 Subject: [PATCH 27/28] Do not use UNION bit for iterable as it is not a type list --- Zend/zend_API.c | 2 +- Zend/zend_compile.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Zend/zend_API.c b/Zend/zend_API.c index 821f35ee6de4e..662cb23de6356 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -2863,7 +2863,7 @@ ZEND_API zend_result zend_register_functions(zend_class_entry *scope, const zend " regenerate the argument info via the php-src gen_stub build script"); */ zend_type legacy_iterable = ZEND_TYPE_INIT_CLASS_CONST_MASK(ZSTR_KNOWN(ZEND_STR_TRAVERSABLE), - (new_arg_info[i].type.type_mask|_ZEND_TYPE_UNION_BIT|MAY_BE_ARRAY)); + (new_arg_info[i].type.type_mask|MAY_BE_ARRAY)); new_arg_info[i].type = legacy_iterable; } } diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 69b7052e73fcd..0ec50dc58922c 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -6148,7 +6148,7 @@ static zend_type zend_compile_single_typename(zend_ast *ast) if (type_code == IS_ITERABLE) { /* Set iterable bit for BC compat during Reflection and string representation of type */ zend_type iterable = (zend_type) ZEND_TYPE_INIT_CLASS_CONST_MASK(ZSTR_KNOWN(ZEND_STR_TRAVERSABLE), - (_ZEND_TYPE_UNION_BIT|MAY_BE_ARRAY|_ZEND_TYPE_ITERABLE_BIT)); + (MAY_BE_ARRAY|_ZEND_TYPE_ITERABLE_BIT)); return iterable; } @@ -6286,7 +6286,7 @@ static zend_type zend_compile_typename( /* An intersection of union types cannot exist so invalidate it * Currently only can happen with iterable getting canonicalized to Traversable|array */ - if (ZEND_TYPE_IS_UNION(single_type)) { + if (ZEND_TYPE_IS_ITERABLE_FALLBACK(single_type)) { zend_string *standard_type_str = zend_type_to_string(single_type); zend_error_noreturn(E_COMPILE_ERROR, "Type %s cannot be part of an intersection type", ZSTR_VAL(standard_type_str)); From 9adcadc693a31ee33e9c8a5da463613c2b7411ab Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Mon, 30 May 2022 13:06:11 +0100 Subject: [PATCH 28/28] last whitespaces reverts --- Zend/zend_API.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Zend/zend_API.c b/Zend/zend_API.c index 662cb23de6356..6d02703736210 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -3432,8 +3432,8 @@ static bool zend_is_callable_check_class(zend_string *name, zend_class_entry *sc if (!fcc->object) { fcc->object = zend_get_this_object(frame); } - *strict_class = 1; - ret = 1; + *strict_class = 1; + ret = 1; } } else if ((ce = zend_lookup_class(name)) != NULL) { zend_class_entry *scope = get_scope(frame); @@ -3442,8 +3442,8 @@ static bool zend_is_callable_check_class(zend_string *name, zend_class_entry *sc zend_object *object = zend_get_this_object(frame); if (object && - instanceof_function(object->ce, scope) && - instanceof_function(scope, ce)) { + instanceof_function(object->ce, scope) && + instanceof_function(scope, ce)) { fcc->object = object; fcc->called_scope = object->ce; } else {