@@ -508,8 +508,10 @@ static inheritance_status zend_do_perform_implementation_check(
508508 && ((proto -> common .scope -> ce_flags & ZEND_ACC_INTERFACE ) == 0
509509 && (proto -> common .fn_flags & ZEND_ACC_ABSTRACT ) == 0 )));
510510
511- /* If the prototype method is private do not enforce a signature */
512- ZEND_ASSERT (!(proto -> common .fn_flags & ZEND_ACC_PRIVATE ));
511+ /* If the prototype method is private and not abstract, we do not enforce a signature.
512+ * private abstract methods can only occur in traits. */
513+ ZEND_ASSERT (!(proto -> common .fn_flags & ZEND_ACC_PRIVATE )
514+ || (proto -> common .fn_flags & ZEND_ACC_ABSTRACT ));
513515
514516 /* The number of required arguments cannot increase. */
515517 if (proto -> common .required_num_args < fe -> common .required_num_args ) {
@@ -824,7 +826,7 @@ static zend_always_inline inheritance_status do_inheritance_check_on_method_ex(z
824826 child -> common .fn_flags |= ZEND_ACC_CHANGED ;
825827 }
826828
827- if (parent_flags & ZEND_ACC_PRIVATE ) {
829+ if (( parent_flags & ZEND_ACC_PRIVATE ) && !( parent_flags & ZEND_ACC_ABSTRACT ) ) {
828830 return INHERITANCE_SUCCESS ;
829831 }
830832
@@ -1562,7 +1564,8 @@ static void zend_add_trait_method(zend_class_entry *ce, const char *name, zend_s
15621564
15631565 /* Abstract method signatures from the trait must be satisfied. */
15641566 if (fn -> common .fn_flags & ZEND_ACC_ABSTRACT ) {
1565- perform_delayable_implementation_check (ce , existing_fn , fn );
1567+ do_inheritance_check_on_method (existing_fn , fn , ce , NULL );
1568+ fn -> common .prototype = NULL ;
15661569 return ;
15671570 }
15681571
0 commit comments