Skip to content

Commit d4056a9

Browse files
committed
Do not use UNION bit for iterable as it is not a type list
1 parent ae53b04 commit d4056a9

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

Zend/zend_API.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2863,7 +2863,7 @@ ZEND_API zend_result zend_register_functions(zend_class_entry *scope, const zend
28632863
" regenerate the argument info via the php-src gen_stub build script");
28642864
*/
28652865
zend_type legacy_iterable = ZEND_TYPE_INIT_CLASS_CONST_MASK(ZSTR_KNOWN(ZEND_STR_TRAVERSABLE),
2866-
(new_arg_info[i].type.type_mask|_ZEND_TYPE_UNION_BIT|MAY_BE_ARRAY));
2866+
(new_arg_info[i].type.type_mask|MAY_BE_ARRAY));
28672867
new_arg_info[i].type = legacy_iterable;
28682868
}
28692869
}

Zend/zend_compile.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6148,7 +6148,7 @@ static zend_type zend_compile_single_typename(zend_ast *ast)
61486148
if (type_code == IS_ITERABLE) {
61496149
/* Set iterable bit for BC compat during Reflection and string representation of type */
61506150
zend_type iterable = (zend_type) ZEND_TYPE_INIT_CLASS_CONST_MASK(ZSTR_KNOWN(ZEND_STR_TRAVERSABLE),
6151-
(_ZEND_TYPE_UNION_BIT|MAY_BE_ARRAY|_ZEND_TYPE_ITERABLE_BIT));
6151+
(MAY_BE_ARRAY|_ZEND_TYPE_ITERABLE_BIT));
61526152
return iterable;
61536153
}
61546154

@@ -6286,7 +6286,7 @@ static zend_type zend_compile_typename(
62866286

62876287
/* An intersection of union types cannot exist so invalidate it
62886288
* Currently only can happen with iterable getting canonicalized to Traversable|array */
6289-
if (ZEND_TYPE_IS_UNION(single_type)) {
6289+
if (ZEND_TYPE_IS_ITERABLE_FALLBACK(single_type)) {
62906290
zend_string *standard_type_str = zend_type_to_string(single_type);
62916291
zend_error_noreturn(E_COMPILE_ERROR,
62926292
"Type %s cannot be part of an intersection type", ZSTR_VAL(standard_type_str));

0 commit comments

Comments
 (0)