com php-src: Fixed bug #73583 (Segfaults when conditionally declared class and function have the same name): NEWS ext/opcache/Optimizer/co
mpact_literals.c ext/opcache/tests/bug73583.p hpt
| From: | Xinchen Hui | Date: | Wed, 23 Nov 2016 06:24:46 +0000 |
| Subject: | com php-src: Fixed bug #73583 (Segfaults when conditionally declared class and function have the same name): NEWS ext/opcache/Optimizer/co mpact_literals.c ext/opcache/tests/bug73583.p hpt |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-95997@lists.php.net to get a copy of this message | ||
Commit: a0b28434ccaafadfdd39a0b51eab5aa4dd693291
Author: Xinchen Hui <laruence@gmail.com> Wed, 23 Nov 2016 14:24:46 +0800
Parents: 1c733a345f65c34eb05c93af127338c0583d3065
Branches: PHP-7.1 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=a0b28434ccaafadfdd39a0b51eab5aa4dd693291
Log:
Fixed bug #73583 (Segfaults when conditionally declared class and function have the same name)
bug was introduced in rev 88eae43f , and the runtime defined key is not
merged-able
Bugs:
https://bugs.php.net/73583
Changed paths:
M NEWS
M ext/opcache/Optimizer/compact_literals.c
A ext/opcache/tests/bug73583.phpt
Diff:
diff --git a/NEWS b/NEWS
index 2679337..f17b01b 100644
--- a/NEWS
+++ b/NEWS
@@ -23,6 +23,8 @@ PHP NEWS
. Fixed bug #64526 (Add missing mysqlnd.* parameters to php.ini-*). (cmb)
- Opcache:
+ . Fixed bug #73583 (Segfaults when conditionally declared class and function
+ have the same name). (Laruence)
. Fixed bug #69090 (check cached files permissions)
- OpenSSL:
diff --git a/ext/opcache/Optimizer/compact_literals.c b/ext/opcache/Optimizer/compact_literals.c
index 445b579..e59fbb4 100644
--- a/ext/opcache/Optimizer/compact_literals.c
+++ b/ext/opcache/Optimizer/compact_literals.c
@@ -292,7 +292,7 @@ void zend_optimizer_compact_literals(zend_op_array *op_array, zend_optimizer_ctx
case ZEND_DECLARE_CLASS:
case ZEND_DECLARE_INHERITED_CLASS:
case ZEND_DECLARE_INHERITED_CLASS_DELAYED:
- LITERAL_INFO(opline->op1.constant, LITERAL_VALUE, 1, 0, 2);
+ LITERAL_INFO(opline->op1.constant, LITERAL_VALUE, 0, 0, 2);
break;
case ZEND_RECV:
case ZEND_RECV_VARIADIC:
diff --git a/ext/opcache/tests/bug73583.phpt b/ext/opcache/tests/bug73583.phpt
new file mode 100644
index 0000000..e947b45
--- /dev/null
+++ b/ext/opcache/tests/bug73583.phpt
@@ -0,0 +1,19 @@
+--TEST--
+Bug #73583 (Segfaults when conditionally declared class and function have the same name)
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.optimization_level=0x4ff
+opcache.file_update_protection=0
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+if (true) {
+ class A { }
+ function A() { }
+ function A() { }
+}
+?>
+--EXPECTF--
+Fatal error: Cannot redeclare A() (previously declared in %sbug73583.php:4) in %sbug73583.php on
line 5