]> granicus.if.org Git - php/commitdiff
Fixed bug #72635
authorNikita Popov <nikita.ppv@gmail.com>
Sat, 29 Sep 2018 12:15:58 +0000 (14:15 +0200)
committerNikita Popov <nikita.ppv@gmail.com>
Sat, 29 Sep 2018 12:21:08 +0000 (14:21 +0200)
This seems to be a simple oversight, where we did not enable
exceptions. Other constexpr conditions already throw, so there is
no particular reason to stick to a fatal error here.

NEWS
Zend/tests/bug43344_3.phpt
Zend/tests/bug43344_4.phpt
Zend/tests/bug43344_5.phpt
Zend/tests/class_constants_002.phpt
Zend/zend_compile.c
tests/classes/constants_error_004.phpt

diff --git a/NEWS b/NEWS
index 1f48fb5f17685b6d791ef62a28716f0da0405e02..906b6a67e8330beb03e890b3331c38d1ed58f43b 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -6,6 +6,8 @@ PHP                                                                        NEWS
   . Fixed bug #76846 (Segfault in shutdown function after memory limit error).
     (Nikita)
   . Fixed bug #76946 (Cyclic reference in generator not detected). (Nikita)
+  . Fixed bug #72635 (Undefined class used by class constant in constexpr
+    generates fatal error). (Nikita)
 
 27 Sep 2018, PHP 7.3.0RC2
 
index 579ed81adaffe569f22696d05b222208ed2a5f0d..5450759bcc7dd9b88dbc091dafd033b85cc00577 100644 (file)
@@ -9,4 +9,8 @@ function f($a=Foo::bar) {
 echo f()."\n";
 ?>
 --EXPECTF--
-Fatal error: Class 'Foo\Foo' not found in %sbug43344_3.php on line %d
+Fatal error: Uncaught Error: Class 'Foo\Foo' not found in %s:%d
+Stack trace:
+#0 %s(%d): Foo\f()
+#1 {main}
+  thrown in %s on line %d
index 97e08b3664e109927b170a70c134952ba91fbb71..c147766bf6b2b35065fa17effb1b99941f139f3d 100644 (file)
@@ -9,4 +9,8 @@ function f($a=array(Foo::bar)) {
 echo f()."\n";
 ?>
 --EXPECTF--
-Fatal error: Class 'Foo\Foo' not found in %sbug43344_4.php on line %d
+Fatal error: Uncaught Error: Class 'Foo\Foo' not found in %s:%d
+Stack trace:
+#0 %s(%d): Foo\f()
+#1 {main}
+  thrown in %s on line %d
index 645ef33e7f3d37261ca72a8dc667a264c0a37b9a..8cc333fd3143c8ba04cd7d43a4a84f368247864a 100644 (file)
@@ -10,4 +10,8 @@ function f($a=array(Foo::bar=>0)) {
 echo f()."\n";
 ?>
 --EXPECTF--
-Fatal error: Class 'Foo\Foo' not found in %sbug43344_5.php on line %d
+Fatal error: Uncaught Error: Class 'Foo\Foo' not found in %s:%d
+Stack trace:
+#0 %s(%d): Foo\f()
+#1 {main}
+  thrown in %s on line %d
index 9aad8088da800e350d1025d4a9630d815402ef89..48d0fd8502b879f7c62f59a42ad6cd5cb3e269a7 100644 (file)
@@ -28,4 +28,8 @@ int(1)
 int(5)
 int(10)
 
-Fatal error: Class 'NoSuchClass' not found in %s on line %d
+Fatal error: Uncaught Error: Class 'NoSuchClass' not found in %s:%d
+Stack trace:
+#0 %s(%d): bar()
+#1 {main}
+  thrown in %s on line %d
index 8a5d15bfa30cb028635b2765f9f2bbd2d1c82808..f018d10152e9c6d528336ab90505a9c86e9a6a45 100644 (file)
@@ -8033,7 +8033,7 @@ void zend_compile_const_expr_class_const(zend_ast **ast_ptr) /* {{{ */
        zend_ast_destroy(ast);
        zend_string_release_ex(class_name, 0);
 
-       *ast_ptr = zend_ast_create_constant(name, fetch_type);
+       *ast_ptr = zend_ast_create_constant(name, fetch_type | ZEND_FETCH_CLASS_EXCEPTION);
 }
 /* }}} */
 
index 3f34473dad12c24a8bd5066669650f4ae7d30a03..27777f8772ac8cc282da4066ef41d9ee56a1c913 100644 (file)
@@ -10,4 +10,7 @@ Class constant whose initial value references a non-existent class
   $a = new C();
 ?>
 --EXPECTF--
-Fatal error: Class 'D' not found in %s on line %d
+Fatal error: Uncaught Error: Class 'D' not found in %s:%d
+Stack trace:
+#0 {main}
+  thrown in %s on line %d