@@ -461,7 +461,7 @@ static inheritance_status zend_perform_covariant_class_type_check(
461
461
462
462
static inheritance_status zend_perform_covariant_type_check (
463
463
zend_class_entry * fe_scope , zend_type fe_type ,
464
- zend_class_entry * proto_scope , zend_type proto_type , bool tentative ) /* {{{ */
464
+ zend_class_entry * proto_scope , zend_type proto_type )
465
465
{
466
466
ZEND_ASSERT (ZEND_TYPE_IS_SET (fe_type ) && ZEND_TYPE_IS_SET (proto_type ));
467
467
@@ -502,7 +502,7 @@ static inheritance_status zend_perform_covariant_type_check(
502
502
503
503
if (added_types ) {
504
504
/* Otherwise adding new types is illegal */
505
- return tentative ? INHERITANCE_WARNING : INHERITANCE_ERROR ;
505
+ return INHERITANCE_ERROR ;
506
506
}
507
507
}
508
508
@@ -528,7 +528,7 @@ static inheritance_status zend_perform_covariant_type_check(
528
528
}
529
529
530
530
if (status == INHERITANCE_ERROR ) {
531
- return tentative ? INHERITANCE_WARNING : INHERITANCE_ERROR ;
531
+ return INHERITANCE_ERROR ;
532
532
}
533
533
if (status != INHERITANCE_SUCCESS ) {
534
534
all_success = 0 ;
@@ -557,7 +557,6 @@ static inheritance_status zend_perform_covariant_type_check(
557
557
} ZEND_TYPE_FOREACH_END ();
558
558
return INHERITANCE_UNRESOLVED ;
559
559
}
560
- /* }}} */
561
560
562
561
static inheritance_status zend_do_perform_arg_type_hint_check (
563
562
zend_class_entry * fe_scope , zend_arg_info * fe_arg_info ,
@@ -576,7 +575,7 @@ static inheritance_status zend_do_perform_arg_type_hint_check(
576
575
/* Contravariant type check is performed as a covariant type check with swapped
577
576
* argument order. */
578
577
return zend_perform_covariant_type_check (
579
- proto_scope , proto_arg_info -> type , fe_scope , fe_arg_info -> type , 0 );
578
+ proto_scope , proto_arg_info -> type , fe_scope , fe_arg_info -> type );
580
579
}
581
580
/* }}} */
582
581
@@ -678,15 +677,14 @@ static inheritance_status zend_do_perform_implementation_check(
678
677
}
679
678
680
679
local_status = zend_perform_covariant_type_check (
681
- fe_scope , fe -> common .arg_info [-1 ].type ,
682
- proto_scope , proto -> common .arg_info [-1 ].type , ZEND_ARG_TYPE_IS_TENTATIVE (& proto -> common .arg_info [-1 ]));
680
+ fe_scope , fe -> common .arg_info [-1 ].type , proto_scope , proto -> common .arg_info [-1 ].type );
683
681
684
682
if (UNEXPECTED (local_status != INHERITANCE_SUCCESS )) {
685
- if (UNEXPECTED (local_status == INHERITANCE_ERROR || local_status == INHERITANCE_WARNING )) {
686
- return local_status ;
683
+ if (local_status == INHERITANCE_ERROR
684
+ && ZEND_ARG_TYPE_IS_TENTATIVE (& proto -> common .arg_info [-1 ])) {
685
+ local_status = INHERITANCE_WARNING ;
687
686
}
688
- ZEND_ASSERT (local_status == INHERITANCE_UNRESOLVED );
689
- status = INHERITANCE_UNRESOLVED ;
687
+ return local_status ;
690
688
}
691
689
}
692
690
@@ -1077,9 +1075,9 @@ inheritance_status property_types_compatible(
1077
1075
1078
1076
/* Perform a covariant type check in both directions to determined invariance. */
1079
1077
inheritance_status status1 = zend_perform_covariant_type_check (
1080
- child_info -> ce , child_info -> type , parent_info -> ce , parent_info -> type , 0 );
1078
+ child_info -> ce , child_info -> type , parent_info -> ce , parent_info -> type );
1081
1079
inheritance_status status2 = zend_perform_covariant_type_check (
1082
- parent_info -> ce , parent_info -> type , child_info -> ce , child_info -> type , 0 );
1080
+ parent_info -> ce , parent_info -> type , child_info -> ce , child_info -> type );
1083
1081
if (status1 == INHERITANCE_SUCCESS && status2 == INHERITANCE_SUCCESS ) {
1084
1082
return INHERITANCE_SUCCESS ;
1085
1083
}
0 commit comments