File tree Expand file tree Collapse file tree 4 files changed +17
-4
lines changed Expand file tree Collapse file tree 4 files changed +17
-4
lines changed Original file line number Diff line number Diff line change 1+ --TEST--
2+ Abstract function must be implemented
3+ --FILE--
4+ <?php
5+
6+ abstract class ParentClass {
7+ abstract public function f ();
8+ }
9+
10+ $ o = new class extends ParentClass {};
11+ ?>
12+ --EXPECTF--
13+ Fatal error: Class ParentClass@anonymous must implement 1 abstract method (ParentClass::f) in %sgh15994.php on line 7
Original file line number Diff line number Diff line change @@ -11,4 +11,4 @@ enum B implements A {}
1111
1212?>
1313--EXPECTF--
14- Fatal error: Enum B must implement 1 abstract private method (A::a) in %s on line %d
14+ Fatal error: Enum B must implement 1 abstract method (A::a) in %s on line %d
Original file line number Diff line number Diff line change @@ -17,4 +17,4 @@ class D extends C {
1717
1818?>
1919--EXPECTF--
20- Fatal error: Class C must implement 1 abstract private method (C::method) in %s on line %d
20+ Fatal error: Class C must implement 1 abstract method (C::method) in %s on line %d
Original file line number Diff line number Diff line change @@ -2981,7 +2981,7 @@ void zend_verify_abstract_class(zend_class_entry *ce) /* {{{ */
29812981 const zend_function * func ;
29822982 zend_abstract_info ai ;
29832983 bool is_explicit_abstract = (ce -> ce_flags & ZEND_ACC_EXPLICIT_ABSTRACT_CLASS ) != 0 ;
2984- bool can_be_abstract = (ce -> ce_flags & ZEND_ACC_ENUM ) == 0 ;
2984+ bool can_be_abstract = (ce -> ce_flags & ( ZEND_ACC_ENUM | ZEND_ACC_ANON_CLASS ) ) == 0 ;
29852985 memset (& ai , 0 , sizeof (ai ));
29862986
29872987 ZEND_HASH_MAP_FOREACH_PTR (& ce -> function_table , func ) {
@@ -3022,7 +3022,7 @@ void zend_verify_abstract_class(zend_class_entry *ce) /* {{{ */
30223022 );
30233023 } else {
30243024 zend_error_noreturn (E_ERROR ,
3025- "%s %s must implement %d abstract private method%s (" MAX_ABSTRACT_INFO_FMT MAX_ABSTRACT_INFO_FMT MAX_ABSTRACT_INFO_FMT ")" ,
3025+ "%s %s must implement %d abstract method%s (" MAX_ABSTRACT_INFO_FMT MAX_ABSTRACT_INFO_FMT MAX_ABSTRACT_INFO_FMT ")" ,
30263026 zend_get_object_type_uc (ce ),
30273027 ZSTR_VAL (ce -> name ), ai .cnt ,
30283028 ai .cnt > 1 ? "s" : "" ,
You can’t perform that action at this time.
0 commit comments