@@ -1007,18 +1007,9 @@ static zend_always_inline bool zend_check_type_slow(
1007
1007
} else {
1008
1008
ZEND_TYPE_LIST_FOREACH (ZEND_TYPE_LIST (* type ), list_type ) {
1009
1009
ce = zend_fetch_ce_from_cache_slot (cache_slot , list_type );
1010
- /* If we cannot resolve the CE we cannot check if it satisfies
1011
- * the type constraint, check the next one. */
1012
- if (ce == NULL ) {
1013
- if (HAVE_CACHE_SLOT ) {
1014
- cache_slot ++ ;
1015
- }
1016
- continue ;
1017
- }
1018
-
1019
- /* Perform actual type check */
1010
+ /* Perform actual type check if we have a CE */
1020
1011
/* Instance of a single type part of a union is sufficient to pass the type check */
1021
- if (instanceof_function (Z_OBJCE_P (arg ), ce )) {
1012
+ if (ce && instanceof_function (Z_OBJCE_P (arg ), ce )) {
1022
1013
return true;
1023
1014
}
1024
1015
if (HAVE_CACHE_SLOT ) {
@@ -1028,19 +1019,14 @@ static zend_always_inline bool zend_check_type_slow(
1028
1019
}
1029
1020
} else {
1030
1021
ce = zend_fetch_ce_from_cache_slot (cache_slot , type );
1031
- /* If we cannot resolve the CE we cannot check if it satisfies
1032
- * the type constraint, check if a standard type satisfies it. */
1033
- if (ce == NULL ) {
1034
- goto builtin_types ;
1035
- }
1036
-
1037
- if (instanceof_function (Z_OBJCE_P (arg ), ce )) {
1038
- return 1 ;
1022
+ /* If we have a CE we check if it satisfies the type constraint,
1023
+ * otherwise it will check if a standard type satisfies it. */
1024
+ if (ce && instanceof_function (Z_OBJCE_P (arg ), ce )) {
1025
+ return true;
1039
1026
}
1040
1027
}
1041
1028
}
1042
1029
1043
- builtin_types :
1044
1030
type_mask = ZEND_TYPE_FULL_MASK (* type );
1045
1031
if ((type_mask & MAY_BE_CALLABLE ) && zend_is_callable (arg , 0 , NULL )) {
1046
1032
return 1 ;
0 commit comments