diff --git a/Zend/tests/bug69084.phpt b/Zend/tests/bug69084.phpt index 2cefcc54320f1..8b10ef2fb53d7 100644 --- a/Zend/tests/bug69084.phpt +++ b/Zend/tests/bug69084.phpt @@ -26,4 +26,4 @@ $b->main(); ?> --EXPECTF-- -Fatal error: Class Bar contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (Bar::doOtherStuff) in %s on line %d +Fatal error: Class Bar contains 1 abstract method and must therefore be declared abstract or implement the remaining method (Bar::doOtherStuff) in %s on line %d diff --git a/Zend/tests/errmsg_018.phpt b/Zend/tests/errmsg_018.phpt index 13a0cf451114a..070247e4d419c 100644 --- a/Zend/tests/errmsg_018.phpt +++ b/Zend/tests/errmsg_018.phpt @@ -10,4 +10,4 @@ class test { echo "Done\n"; ?> --EXPECTF-- -Fatal error: Class test contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (test::foo) in %s on line %d +Fatal error: Class test contains 1 abstract method and must therefore be declared abstract or implement the remaining method (test::foo) in %s on line %d diff --git a/Zend/tests/property_hooks/abstract_get_set_readonly.phpt b/Zend/tests/property_hooks/abstract_get_set_readonly.phpt index 644ffb474960b..e8cb95019cc08 100644 --- a/Zend/tests/property_hooks/abstract_get_set_readonly.phpt +++ b/Zend/tests/property_hooks/abstract_get_set_readonly.phpt @@ -10,4 +10,4 @@ class C extends P { } ?> --EXPECTF-- -Fatal error: Class C contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (P::$prop::set) in %s on line %d +Fatal error: Class C contains 1 abstract method and must therefore be declared abstract or implement the remaining method (P::$prop::set) in %s on line %d diff --git a/Zend/tests/property_hooks/abstract_hook_in_non_abstract_class.phpt b/Zend/tests/property_hooks/abstract_hook_in_non_abstract_class.phpt index fe27f3ecebc5e..d3b8396a55f0a 100644 --- a/Zend/tests/property_hooks/abstract_hook_in_non_abstract_class.phpt +++ b/Zend/tests/property_hooks/abstract_hook_in_non_abstract_class.phpt @@ -12,4 +12,4 @@ class Test { ?> --EXPECTF-- -Fatal error: Class Test contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (Test::$prop::get) in %s on line %d +Fatal error: Class Test contains 1 abstract method and must therefore be declared abstract or implement the remaining method (Test::$prop::get) in %s on line %d diff --git a/Zend/tests/property_hooks/abstract_hook_not_implemented.phpt b/Zend/tests/property_hooks/abstract_hook_not_implemented.phpt index bb94c0650b01a..24fd4f1ef1ed5 100644 --- a/Zend/tests/property_hooks/abstract_hook_not_implemented.phpt +++ b/Zend/tests/property_hooks/abstract_hook_not_implemented.phpt @@ -14,4 +14,4 @@ class B extends A {} ?> --EXPECTF-- -Fatal error: Class B contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (A::$prop::get) in %s on line %d +Fatal error: Class B contains 1 abstract method and must therefore be declared abstract or implement the remaining method (A::$prop::get) in %s on line %d diff --git a/Zend/tests/property_hooks/invalid_abstract_indirect.phpt b/Zend/tests/property_hooks/invalid_abstract_indirect.phpt index 834440a7f6885..b04d44c8c8a85 100644 --- a/Zend/tests/property_hooks/invalid_abstract_indirect.phpt +++ b/Zend/tests/property_hooks/invalid_abstract_indirect.phpt @@ -13,4 +13,4 @@ class B extends A { ?> --EXPECTF-- -Fatal error: Class B contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (A::$prop::get) in %s on line %d +Fatal error: Class B contains 1 abstract method and must therefore be declared abstract or implement the remaining method (A::$prop::get) in %s on line %d diff --git a/Zend/tests/property_hooks/invalid_abstract_indirect_2.phpt b/Zend/tests/property_hooks/invalid_abstract_indirect_2.phpt index 28938c17540b5..8526562c2adf5 100644 --- a/Zend/tests/property_hooks/invalid_abstract_indirect_2.phpt +++ b/Zend/tests/property_hooks/invalid_abstract_indirect_2.phpt @@ -12,4 +12,4 @@ class B extends A { ?> --EXPECTF-- -Fatal error: Class B contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (A::$prop::get) in %s on line %d +Fatal error: Class B contains 1 abstract method and must therefore be declared abstract or implement the remaining method (A::$prop::get) in %s on line %d diff --git a/Zend/tests/traits/bugs/abstract-methods01.phpt b/Zend/tests/traits/bugs/abstract-methods01.phpt index 721f9657594d8..e50f94ccefeb4 100644 --- a/Zend/tests/traits/bugs/abstract-methods01.phpt +++ b/Zend/tests/traits/bugs/abstract-methods01.phpt @@ -16,4 +16,4 @@ $test = new TraitsTest(); $test->hello(); ?> --EXPECTF-- -Fatal error: Class %s contains %d abstract method and must therefore be declared abstract or implement the remaining methods (%s) in %s on line %d +Fatal error: Class %s contains %d abstract method and must therefore be declared abstract or implement the remaining method (%s) in %s on line %d diff --git a/Zend/tests/traits/interface_002.phpt b/Zend/tests/traits/interface_002.phpt index bc56a6d68bf73..4d48706cc95b0 100644 --- a/Zend/tests/traits/interface_002.phpt +++ b/Zend/tests/traits/interface_002.phpt @@ -21,4 +21,4 @@ new bar; ?> --EXPECTF-- -Fatal error: Class bar contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (baz::abc) in %s on line %d +Fatal error: Class bar contains 1 abstract method and must therefore be declared abstract or implement the remaining method (baz::abc) in %s on line %d diff --git a/Zend/zend_inheritance.c b/Zend/zend_inheritance.c index f34b8d39323dd..a3aa58cc23562 100644 --- a/Zend/zend_inheritance.c +++ b/Zend/zend_inheritance.c @@ -3009,16 +3009,28 @@ void zend_verify_abstract_class(zend_class_entry *ce) /* {{{ */ } if (ai.cnt) { - zend_error_noreturn(E_ERROR, !is_explicit_abstract && can_be_abstract - ? "%s %s contains %d abstract method%s and must therefore be declared abstract or implement the remaining methods (" MAX_ABSTRACT_INFO_FMT MAX_ABSTRACT_INFO_FMT MAX_ABSTRACT_INFO_FMT ")" - : "%s %s must implement %d abstract private method%s (" MAX_ABSTRACT_INFO_FMT MAX_ABSTRACT_INFO_FMT MAX_ABSTRACT_INFO_FMT ")", - zend_get_object_type_uc(ce), - ZSTR_VAL(ce->name), ai.cnt, - ai.cnt > 1 ? "s" : "", - DISPLAY_ABSTRACT_FN(0), - DISPLAY_ABSTRACT_FN(1), - DISPLAY_ABSTRACT_FN(2) + if (!is_explicit_abstract && can_be_abstract) { + zend_error_noreturn(E_ERROR, + "%s %s contains %d abstract method%s and must therefore be declared abstract or implement the remaining method%s (" MAX_ABSTRACT_INFO_FMT MAX_ABSTRACT_INFO_FMT MAX_ABSTRACT_INFO_FMT ")", + zend_get_object_type_uc(ce), + ZSTR_VAL(ce->name), ai.cnt, + ai.cnt > 1 ? "s" : "", + ai.cnt > 1 ? "s" : "", + DISPLAY_ABSTRACT_FN(0), + DISPLAY_ABSTRACT_FN(1), + DISPLAY_ABSTRACT_FN(2) + ); + } else { + zend_error_noreturn(E_ERROR, + "%s %s must implement %d abstract private method%s (" MAX_ABSTRACT_INFO_FMT MAX_ABSTRACT_INFO_FMT MAX_ABSTRACT_INFO_FMT ")", + zend_get_object_type_uc(ce), + ZSTR_VAL(ce->name), ai.cnt, + ai.cnt > 1 ? "s" : "", + DISPLAY_ABSTRACT_FN(0), + DISPLAY_ABSTRACT_FN(1), + DISPLAY_ABSTRACT_FN(2) ); + } } else { /* now everything should be fine and an added ZEND_ACC_IMPLICIT_ABSTRACT_CLASS should be removed */ ce->ce_flags &= ~ZEND_ACC_IMPLICIT_ABSTRACT_CLASS; diff --git a/tests/classes/abstract_by_interface_001.phpt b/tests/classes/abstract_by_interface_001.phpt index a8a6ad31da9c2..0e165ace25b3d 100644 --- a/tests/classes/abstract_by_interface_001.phpt +++ b/tests/classes/abstract_by_interface_001.phpt @@ -30,4 +30,4 @@ class Fails extends Root implements MyInterface { object(Leaf)#%d (0) { } -Fatal error: Class Fails contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (MyInterface::MyInterfaceFunc) in %sabstract_by_interface_001.php on line %d +Fatal error: Class Fails contains 1 abstract method and must therefore be declared abstract or implement the remaining method (MyInterface::MyInterfaceFunc) in %sabstract_by_interface_001.php on line %d diff --git a/tests/classes/abstract_by_interface_002.phpt b/tests/classes/abstract_by_interface_002.phpt index 83fc18ad95c4a..863ae06e7a789 100644 --- a/tests/classes/abstract_by_interface_002.phpt +++ b/tests/classes/abstract_by_interface_002.phpt @@ -30,4 +30,4 @@ class Fails extends Root implements MyInterface { object(Leaf)#%d (0) { } -Fatal error: Class Fails contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (MyInterface::MyInterfaceFunc) in %sabstract_by_interface_002.php on line %d +Fatal error: Class Fails contains 1 abstract method and must therefore be declared abstract or implement the remaining method (MyInterface::MyInterfaceFunc) in %sabstract_by_interface_002.php on line %d diff --git a/tests/classes/abstract_derived.phpt b/tests/classes/abstract_derived.phpt index db040e1342bf1..11c9125a7724e 100644 --- a/tests/classes/abstract_derived.phpt +++ b/tests/classes/abstract_derived.phpt @@ -13,4 +13,4 @@ class derived extends base { ?> ===DONE=== --EXPECTF-- -Fatal error: Class derived contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (derived::show) in %sabstract_derived.php on line %d +Fatal error: Class derived contains 1 abstract method and must therefore be declared abstract or implement the remaining method (derived::show) in %sabstract_derived.php on line %d diff --git a/tests/classes/abstract_not_declared.phpt b/tests/classes/abstract_not_declared.phpt index 611cb3cc94ce9..8f899f0e718af 100644 --- a/tests/classes/abstract_not_declared.phpt +++ b/tests/classes/abstract_not_declared.phpt @@ -10,4 +10,4 @@ class fail { echo "Done\n"; // shouldn't be displayed ?> --EXPECTF-- -Fatal error: Class fail contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (fail::show) in %s on line %d +Fatal error: Class fail contains 1 abstract method and must therefore be declared abstract or implement the remaining method (fail::show) in %s on line %d diff --git a/tests/classes/abstract_redeclare.phpt b/tests/classes/abstract_redeclare.phpt index 843570ba2e18d..f8e3d23465244 100644 --- a/tests/classes/abstract_redeclare.phpt +++ b/tests/classes/abstract_redeclare.phpt @@ -16,4 +16,4 @@ class fail extends pass { echo "Done\n"; // Shouldn't be displayed ?> --EXPECTF-- -Fatal error: Class fail contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (fail::show) in %sabstract_redeclare.php on line %d +Fatal error: Class fail contains 1 abstract method and must therefore be declared abstract or implement the remaining method (fail::show) in %sabstract_redeclare.php on line %d diff --git a/tests/classes/abstract_static.phpt b/tests/classes/abstract_static.phpt index 60ff284784869..ab13289ab4cd8 100644 --- a/tests/classes/abstract_static.phpt +++ b/tests/classes/abstract_static.phpt @@ -31,4 +31,4 @@ echo "Done\n"; // shouldn't be displayed --EXPECTF-- Call to function show() -Fatal error: Class fail contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (fail::func) in %sabstract_static.php(%d) : eval()'d code on line %d +Fatal error: Class fail contains 1 abstract method and must therefore be declared abstract or implement the remaining method (fail::func) in %sabstract_static.php(%d) : eval()'d code on line %d diff --git a/tests/classes/interface_must_be_implemented.phpt b/tests/classes/interface_must_be_implemented.phpt index 300ace23e3d25..8436c663834a5 100644 --- a/tests/classes/interface_must_be_implemented.phpt +++ b/tests/classes/interface_must_be_implemented.phpt @@ -12,4 +12,4 @@ class derived_a implements if_a { ?> --EXPECTF-- -Fatal error: Class derived_a contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (if_a::f_a) in %s on line %d +Fatal error: Class derived_a contains 1 abstract method and must therefore be declared abstract or implement the remaining method (if_a::f_a) in %s on line %d diff --git a/tests/classes/interfaces_002.phpt b/tests/classes/interfaces_002.phpt index 14ac1f0ffc0b8..de068b98dc9fc 100644 --- a/tests/classes/interfaces_002.phpt +++ b/tests/classes/interfaces_002.phpt @@ -23,4 +23,4 @@ echo "Message: " . $foo->getMessage() . "\n"; ?> ===DONE=== --EXPECTF-- -Fatal error: Class Exception_foo contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (ThrowableInterface::getErrno) in %s on line %d +Fatal error: Class Exception_foo contains 1 abstract method and must therefore be declared abstract or implement the remaining method (ThrowableInterface::getErrno) in %s on line %d