]> granicus.if.org Git - php/commitdiff
Promote "Cannot use parent" to fatal error
authorNikita Popov <nikita.ppv@gmail.com>
Tue, 15 Oct 2019 09:46:48 +0000 (11:46 +0200)
committerNikita Popov <nikita.ppv@gmail.com>
Tue, 15 Oct 2019 09:46:48 +0000 (11:46 +0200)
UPGRADING
Zend/tests/class_name_as_scalar_error_002.phpt
Zend/tests/type_declarations/variance/parent_in_class_failure1.phpt
Zend/zend_compile.c

index 7783f92f9b9d1d62afefbc417dadfd91a3a148f6..a0d31617c88c23fba958dd87fa7115286a50a0ce 100644 (file)
--- a/UPGRADING
+++ b/UPGRADING
@@ -45,6 +45,8 @@ PHP 8.0 UPGRADE NOTES
   . The default error_reporting level is now E_ALL. Previously it excluded
     E_NOTICE and E_DEPRECATED.
   . display_startup_errors is now enabled by default.
+  . Using "parent" inside a class that has no parent will now result in a
+    fatal compile-time error.
   . The @ operator will no longer silence fatal errors (E_ERROR, E_CORE_ERROR,
     E_COMPILE_ERROR, E_USER_ERROR, E_RECOVERABLE_ERROR, E_PARSE). Error handlers
     that expect error_reporting to be 0 when @ is used, should be adjusted to
index cbea0c2dcca733b7e11ea5a1e0fca0d957aac46e..ebb2dd4c27122e2a54a2375112d551a0619bccd7 100644 (file)
@@ -11,9 +11,4 @@ namespace Foo\Bar {
 }
 ?>
 --EXPECTF--
-Deprecated: Cannot use "parent" when current class scope has no parent in %s on line %d
-
-Fatal error: Uncaught Error: Cannot use "parent" when current class scope has no parent in %s:%d
-Stack trace:
-#0 {main}
-  thrown in %s on line %d
+Fatal error: Cannot use "parent" when current class scope has no parent in %s on line %d
index 2261b3c016737f77db6e84e160b419432954790c..6bbf4881a89c2d94dd0213a296b2aa6ccc3d5cf2 100644 (file)
@@ -13,6 +13,4 @@ class B extends A {
 
 ?>
 --EXPECTF--
-Deprecated: Cannot use "parent" when current class scope has no parent in %s on line %d
-
-Fatal error: Could not check compatibility between B::method(A $x) and A::method(parent $x), because class parent is not available in %s on line %d
+Fatal error: Cannot use "parent" when current class scope has no parent in %s on line %d
index 64b9bc70325cd869487e46bb917fcc7cc2055209..4ac3eaa670800422e63912426b6664c32013adee 100644 (file)
@@ -1408,7 +1408,7 @@ static void zend_ensure_valid_class_fetch_type(uint32_t fetch_type) /* {{{ */
                                fetch_type == ZEND_FETCH_CLASS_SELF ? "self" :
                                fetch_type == ZEND_FETCH_CLASS_PARENT ? "parent" : "static");
                } else if (fetch_type == ZEND_FETCH_CLASS_PARENT && !ce->parent_name) {
-                       zend_error(E_DEPRECATED,
+                       zend_error_noreturn(E_COMPILE_ERROR,
                                "Cannot use \"parent\" when current class scope has no parent");
                }
        }