Skip to content

Commit fc3e75f

Browse files
committed
Fix iterable type for internal functions
1 parent cef75fa commit fc3e75f

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

Zend/zend_execute.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1042,6 +1042,11 @@ static zend_always_inline bool zend_check_type_slow(
10421042
}
10431043

10441044
type_mask = ZEND_TYPE_FULL_MASK(*type);
1045+
/* Fallback for iterable */
1046+
// TODO Fix gen_stubs
1047+
if ((type_mask & _ZEND_TYPE_ITERABLE_BIT) && zend_is_iterable(arg)) {
1048+
return 1;
1049+
}
10451050
if ((type_mask & MAY_BE_CALLABLE) && zend_is_callable(arg, 0, NULL)) {
10461051
return 1;
10471052
}

Zend/zend_types.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,8 +266,8 @@ typedef struct {
266266
{ NULL, (_type_mask) }
267267

268268
#define ZEND_TYPE_INIT_CODE(code, allow_null, extra_flags) \
269-
ZEND_TYPE_INIT_MASK(((code) == _IS_BOOL ? MAY_BE_BOOL : ((code) == IS_MIXED ? MAY_BE_ANY : (1 << (code)))) \
270-
| ((allow_null) ? _ZEND_TYPE_NULLABLE_BIT : 0) | (extra_flags))
269+
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))))) \
270+
| ((allow_null) ? _ZEND_TYPE_NULLABLE_BIT : 0) | (extra_flags)) \
271271

272272
#define ZEND_TYPE_INIT_PTR(ptr, type_kind, allow_null, extra_flags) \
273273
{ (void *) (ptr), \

0 commit comments

Comments
 (0)