File tree 4 files changed +17
-4
lines changed
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 {}
11
11
12
12
?>
13
13
--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 {
17
17
18
18
?>
19
19
--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) /* {{{ */
2981
2981
const zend_function * func ;
2982
2982
zend_abstract_info ai ;
2983
2983
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 ;
2985
2985
memset (& ai , 0 , sizeof (ai ));
2986
2986
2987
2987
ZEND_HASH_MAP_FOREACH_PTR (& ce -> function_table , func ) {
@@ -3022,7 +3022,7 @@ void zend_verify_abstract_class(zend_class_entry *ce) /* {{{ */
3022
3022
);
3023
3023
} else {
3024
3024
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 ")" ,
3026
3026
zend_get_object_type_uc (ce ),
3027
3027
ZSTR_VAL (ce -> name ), ai .cnt ,
3028
3028
ai .cnt > 1 ? "s" : "" ,
You can’t perform that action at this time.
0 commit comments