@@ -760,15 +760,11 @@ static void do_inheritance_check_on_method(zend_function *child, zend_function *
760
760
}
761
761
}
762
762
763
- /* TODO Properly handle UNRESOLVED. */
764
-
765
- /*
766
- if (status == INHERITANCE_UNRESOLVED && CG(unverified_types)) {
767
- zend_string *key = zend_string_tolower(fe->common.scope->name);
763
+ if (status == INHERITANCE_UNRESOLVED && CG (unverified_types )) {
764
+ zend_string * key = zend_string_tolower (child -> common .scope -> name );
768
765
zend_hash_add_empty_element (CG (unverified_types ), key );
769
766
zend_string_release (key );
770
- }
771
- */
767
+ }
772
768
}
773
769
} while (0 );
774
770
}
@@ -2222,9 +2218,8 @@ ZEND_API void zend_verify_variance(zend_class_entry *ce)
2222
2218
ZEND_ASSERT (ce -> ce_flags & ZEND_ACC_LINKED );
2223
2219
2224
2220
ZEND_HASH_FOREACH_PTR (& ce -> function_table , child ) {
2225
- zend_function * parent = child -> common .prototype ;
2226
-
2227
2221
/* Methods without prototypes do not need checked for variance. */
2222
+ zend_function * parent = child -> common .prototype ;
2228
2223
if (!parent ) {
2229
2224
continue ;
2230
2225
}
@@ -2236,76 +2231,8 @@ ZEND_API void zend_verify_variance(zend_class_entry *ce)
2236
2231
continue ;
2237
2232
}
2238
2233
2239
- /* We are only willing to ignore this for internal functions because
2240
- * extensions don't always define arg_info. */
2241
- if (missing_internal_arginfo (parent )) {
2242
- continue ;
2243
- }
2244
-
2245
- /* If the parenttype method is private do not enforce a signature */
2246
- if (!(parent -> common .fn_flags & ZEND_ACC_PRIVATE )) {
2247
- uint32_t i , num_args ;
2248
-
2249
- /* Checks for constructors only if they are declared in an interface,
2250
- * or explicitly marked as abstract
2251
- */
2252
- if ((ce -> constructor == child )
2253
- && ((parent -> common .scope -> ce_flags & ZEND_ACC_INTERFACE ) == 0
2254
- && (parent -> common .fn_flags & ZEND_ACC_ABSTRACT ) == 0 ))
2255
- {
2256
- continue ;
2257
- }
2258
-
2259
- /* Check return type compatibility, but only if the prototype already
2260
- * specifies a return type. Adding a new return type is always valid. */
2261
- if (parent -> common .fn_flags & ZEND_ACC_HAS_RETURN_TYPE ) {
2262
- if (child -> common .fn_flags & ZEND_ACC_HAS_RETURN_TYPE ) {
2263
- inheritance_status status = check_inherited_return_type (
2264
- child , & child -> common .arg_info [-1 ],
2265
- parent , & parent -> common .arg_info [-1 ]);
2266
- if (status != INHERITANCE_SUCCESS ) {
2267
- inheritance_runtime_error_msg (child , parent );
2268
- continue ;
2269
- }
2270
- } else {
2271
- // This branch should already have been taken care of
2272
- continue ;
2273
- }
2274
- }
2275
-
2276
- if (parent -> common .required_num_args < child -> common .required_num_args
2277
- || parent -> common .num_args > child -> common .num_args )
2278
- {
2279
- // This branch should already have been taken care of
2280
- continue ;
2281
- }
2282
-
2283
- num_args = parent -> common .num_args ;
2284
- if (parent -> common .fn_flags & ZEND_ACC_VARIADIC ) {
2285
- num_args ++ ;
2286
- if (child -> common .num_args >= parent -> common .num_args ) {
2287
- num_args = child -> common .num_args ;
2288
- if (child -> common .fn_flags & ZEND_ACC_VARIADIC ) {
2289
- num_args ++ ;
2290
- }
2291
- }
2292
- }
2293
-
2294
- for (i = 0 ; i < num_args ; i ++ ) {
2295
- zend_arg_info * child_arg_info = & child -> common .arg_info [i ];
2296
- zend_arg_info * parent_arg_info = (i < parent -> common .num_args )
2297
- ? & parent -> common .arg_info [i ]
2298
- : & parent -> common .arg_info [parent -> common .num_args ];
2299
-
2300
- inheritance_status status = check_inherited_parameter_type (
2301
- child , child_arg_info ,
2302
- parent , parent_arg_info );
2303
- if (status != INHERITANCE_SUCCESS ) {
2304
- inheritance_runtime_error_msg (child , parent );
2305
- continue ;
2306
- }
2307
- }
2308
-
2234
+ if (zend_do_perform_implementation_check (child , parent ) != INHERITANCE_SUCCESS ) {
2235
+ inheritance_runtime_error_msg (child , parent );
2309
2236
}
2310
2237
} ZEND_HASH_FOREACH_END ();
2311
2238
0 commit comments