@@ -793,23 +793,6 @@ static ZEND_COLD void zend_verify_arg_error(
793
793
}
794
794
}
795
795
796
- static int is_null_constant (zend_class_entry * scope , zval * default_value )
797
- {
798
- if (Z_TYPE_P (default_value ) == IS_CONSTANT_AST ) {
799
- zval constant ;
800
-
801
- ZVAL_COPY (& constant , default_value );
802
- if (UNEXPECTED (zval_update_constant_ex (& constant , scope ) != SUCCESS )) {
803
- return 0 ;
804
- }
805
- if (Z_TYPE (constant ) == IS_NULL ) {
806
- return 1 ;
807
- }
808
- zval_ptr_dtor_nogc (& constant );
809
- }
810
- return 0 ;
811
- }
812
-
813
796
static zend_bool zend_verify_weak_scalar_type_hint (zend_uchar type_hint , zval * arg )
814
797
{
815
798
switch (type_hint ) {
@@ -1043,7 +1026,7 @@ static zend_never_inline zval* zend_assign_to_typed_prop(zend_property_info *inf
1043
1026
static zend_always_inline zend_bool zend_check_type (
1044
1027
zend_type type ,
1045
1028
zval * arg , zend_class_entry * * ce , void * * cache_slot ,
1046
- zval * default_value , zend_class_entry * scope ,
1029
+ zend_class_entry * scope ,
1047
1030
zend_bool is_return_type , zend_bool is_internal )
1048
1031
{
1049
1032
zend_reference * ref = NULL ;
@@ -1063,19 +1046,19 @@ static zend_always_inline zend_bool zend_check_type(
1063
1046
} else {
1064
1047
* ce = zend_fetch_class (ZEND_TYPE_NAME (type ), (ZEND_FETCH_CLASS_AUTO | ZEND_FETCH_CLASS_NO_AUTOLOAD ));
1065
1048
if (UNEXPECTED (!* ce )) {
1066
- return Z_TYPE_P (arg ) == IS_NULL && ( ZEND_TYPE_ALLOW_NULL (type ) || ( default_value && is_null_constant ( scope , default_value )) );
1049
+ return Z_TYPE_P (arg ) == IS_NULL && ZEND_TYPE_ALLOW_NULL (type );
1067
1050
}
1068
1051
* cache_slot = (void * ) * ce ;
1069
1052
}
1070
1053
if (EXPECTED (Z_TYPE_P (arg ) == IS_OBJECT )) {
1071
1054
return instanceof_function (Z_OBJCE_P (arg ), * ce );
1072
1055
}
1073
- return Z_TYPE_P (arg ) == IS_NULL && ( ZEND_TYPE_ALLOW_NULL (type ) || ( default_value && is_null_constant ( scope , default_value )) );
1056
+ return Z_TYPE_P (arg ) == IS_NULL && ZEND_TYPE_ALLOW_NULL (type );
1074
1057
} else if (EXPECTED (ZEND_TYPE_CODE (type ) == Z_TYPE_P (arg ))) {
1075
1058
return 1 ;
1076
1059
}
1077
1060
1078
- if (Z_TYPE_P (arg ) == IS_NULL && ( ZEND_TYPE_ALLOW_NULL (type ) || ( default_value && is_null_constant ( scope , default_value )) )) {
1061
+ if (Z_TYPE_P (arg ) == IS_NULL && ZEND_TYPE_ALLOW_NULL (type )) {
1079
1062
/* Null passed to nullable type */
1080
1063
return 1 ;
1081
1064
}
@@ -1104,7 +1087,7 @@ static zend_always_inline zend_bool zend_check_type(
1104
1087
* because this case is already checked at compile-time. */
1105
1088
}
1106
1089
1107
- static zend_always_inline int zend_verify_recv_arg_type (zend_function * zf , uint32_t arg_num , zval * arg , zval * default_value , void * * cache_slot )
1090
+ static zend_always_inline int zend_verify_recv_arg_type (zend_function * zf , uint32_t arg_num , zval * arg , void * * cache_slot )
1108
1091
{
1109
1092
zend_arg_info * cur_arg_info = & zf -> common .arg_info [arg_num - 1 ];
1110
1093
zend_class_entry * ce ;
@@ -1113,15 +1096,15 @@ static zend_always_inline int zend_verify_recv_arg_type(zend_function *zf, uint3
1113
1096
cur_arg_info = & zf -> common .arg_info [arg_num - 1 ];
1114
1097
1115
1098
ce = NULL ;
1116
- if (UNEXPECTED (!zend_check_type (cur_arg_info -> type , arg , & ce , cache_slot , default_value , zf -> common .scope , 0 , 0 ))) {
1099
+ if (UNEXPECTED (!zend_check_type (cur_arg_info -> type , arg , & ce , cache_slot , zf -> common .scope , 0 , 0 ))) {
1117
1100
zend_verify_arg_error (zf , cur_arg_info , arg_num , ce , arg );
1118
1101
return 0 ;
1119
1102
}
1120
1103
1121
1104
return 1 ;
1122
1105
}
1123
1106
1124
- static zend_always_inline int zend_verify_variadic_arg_type (zend_function * zf , uint32_t arg_num , zval * arg , zval * default_value , void * * cache_slot )
1107
+ static zend_always_inline int zend_verify_variadic_arg_type (zend_function * zf , uint32_t arg_num , zval * arg , void * * cache_slot )
1125
1108
{
1126
1109
zend_arg_info * cur_arg_info ;
1127
1110
zend_class_entry * ce ;
@@ -1131,7 +1114,7 @@ static zend_always_inline int zend_verify_variadic_arg_type(zend_function *zf, u
1131
1114
cur_arg_info = & zf -> common .arg_info [zf -> common .num_args ];
1132
1115
1133
1116
ce = NULL ;
1134
- if (UNEXPECTED (!zend_check_type (cur_arg_info -> type , arg , & ce , cache_slot , default_value , zf -> common .scope , 0 , 0 ))) {
1117
+ if (UNEXPECTED (!zend_check_type (cur_arg_info -> type , arg , & ce , cache_slot , zf -> common .scope , 0 , 0 ))) {
1135
1118
zend_verify_arg_error (zf , cur_arg_info , arg_num , ce , arg );
1136
1119
return 0 ;
1137
1120
}
@@ -1158,7 +1141,7 @@ static zend_never_inline ZEND_ATTRIBUTE_UNUSED int zend_verify_internal_arg_type
1158
1141
break ;
1159
1142
}
1160
1143
1161
- if (UNEXPECTED (!zend_check_type (cur_arg_info -> type , arg , & ce , & dummy_cache_slot , NULL , fbc -> common .scope , 0 , /* is_internal */ 1 ))) {
1144
+ if (UNEXPECTED (!zend_check_type (cur_arg_info -> type , arg , & ce , & dummy_cache_slot , fbc -> common .scope , 0 , /* is_internal */ 1 ))) {
1162
1145
return 0 ;
1163
1146
}
1164
1147
arg ++ ;
@@ -1254,7 +1237,7 @@ static int zend_verify_internal_return_type(zend_function *zf, zval *ret)
1254
1237
return 1 ;
1255
1238
}
1256
1239
1257
- if (UNEXPECTED (!zend_check_type (ret_info -> type , ret , & ce , & dummy_cache_slot , NULL , NULL , 1 , /* is_internal */ 1 ))) {
1240
+ if (UNEXPECTED (!zend_check_type (ret_info -> type , ret , & ce , & dummy_cache_slot , NULL , 1 , /* is_internal */ 1 ))) {
1258
1241
zend_verify_internal_return_error (zf , ce , ret );
1259
1242
return 0 ;
1260
1243
}
@@ -1268,7 +1251,7 @@ static zend_always_inline void zend_verify_return_type(zend_function *zf, zval *
1268
1251
zend_arg_info * ret_info = zf -> common .arg_info - 1 ;
1269
1252
zend_class_entry * ce = NULL ;
1270
1253
1271
- if (UNEXPECTED (!zend_check_type (ret_info -> type , ret , & ce , cache_slot , NULL , NULL , 1 , 0 ))) {
1254
+ if (UNEXPECTED (!zend_check_type (ret_info -> type , ret , & ce , cache_slot , NULL , 1 , 0 ))) {
1272
1255
zend_verify_return_error (zf , ce , ret );
1273
1256
}
1274
1257
}
0 commit comments