com php-src: Fixed bug #70828 (php-fpm 5.6 with opcache crashes when referencing a non-existent constant): NEWS Zend/tests/bug70828.phpt
Zend/zend_compile.c
| From: | Xinchen Hui | Date: | Mon, 02 Nov 2015 02:47:02 +0000 |
| Subject: | com php-src: Fixed bug #70828 (php-fpm 5.6 with opcache crashes when referencing a non-existent constant): NEWS Zend/tests/bug70828.phpt Zend/zend_compile.c |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-89580@lists.php.net to get a copy of this message | ||
Commit: 37ed0dafe47fb1053aee7822113bacc1f213337a
Author: Xinchen Hui <laruence@gmail.com> Mon, 2 Nov 2015 10:47:02 +0800
Parents: d5f76caf6cf334d1bb4ca69662065b3bb34d76c5
Branches: PHP-5.6 PHP-7.0 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=37ed0dafe47fb1053aee7822113bacc1f213337a
Log:
Fixed bug #70828 (php-fpm 5.6 with opcache crashes when referencing a non-existent constant)
Bugs:
https://bugs.php.net/70828
Changed paths:
M NEWS
A Zend/tests/bug70828.phpt
M Zend/zend_compile.c
Diff:
diff --git a/NEWS b/NEWS
index f02b240..1ea9e30 100644
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,8 @@ PHP NEWS
?? ??? 2015, PHP 5.6.16
- Core:
+ . Fixed bug #70828 (php-fpm 5.6 with opcache crashes when referencing a
+ non-existent constant). (Laruence)
. Fixed bug #70748 (Segfault in ini_lex () at Zend/zend_ini_scanner.l).
(Laruence)
diff --git a/Zend/tests/bug70828.phpt b/Zend/tests/bug70828.phpt
new file mode 100644
index 0000000..dd285b5
--- /dev/null
+++ b/Zend/tests/bug70828.phpt
@@ -0,0 +1,24 @@
+--TEST--
+Bug #70828 (php-fpm 5.6 with opcache crashes when referencing a non-existent constant)
+--FILE--
+<?php
+
+namespace test {
+ use const nonexistent;
+
+ class test {
+ static function run(){
+ var_dump(nonexistent);
+ existent;
+ }
+ }
+}
+
+namespace {
+ define("test\\existent", "bug!", 1);
+ test\test::run();
+}
+?>
+--EXPECTF--
+Notice: Use of undefined constant nonexistent - assumed 'nonexistent' in
/home/huixinchen/opensource/php-5.6/Zend/tests/bug70828.php on line 8
+string(11) "nonexistent"
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
index 5ff1b04..fca4e2a 100644
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -5804,7 +5804,7 @@ void zend_do_fetch_constant(znode *result, znode *constant_container, znode
*con
opline->op2.constant = zend_add_const_name_literal(CG(active_op_array),
&constant_name->u..constant, 0 TSRMLS_CC);
} else {
opline->extended_value = IS_CONSTANT_UNQUALIFIED;
- if (CG(current_namespace)) {
+ if (check_namespace && CG(current_namespace)) {
opline->extended_value |= IS_CONSTANT_IN_NAMESPACE;
opline->op2.constant = zend_add_const_name_literal(CG(active_op_array),
&constant_name->u.constant, 1 TSRMLS_CC);
} else {