com php-src: Fixed bug #69159 (Opcache causes problem when passing a variable variable to a function): NEWS ext/opcache/Optimizer/op
timize_func_calls.c ext/opcache/tests/bug6915 9.phpt
| From: | Xinchen Hui | Date: | Wed, 04 Mar 2015 06:48:41 +0000 |
| Subject: | com php-src: Fixed bug #69159 (Opcache causes problem when passing a variable variable to a function): NEWS ext/opcache/Optimizer/op timize_func_calls.c ext/opcache/tests/bug6915 9.phpt |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-85196@lists.php.net to get a copy of this message | ||
Commit: a29b64fc1029b4121e3e9ff20901c35ad600b4da
Author: Xinchen Hui <laruence@php.net> Wed, 4 Mar 2015 14:48:41 +0800
Parents: 6183408031d9d01ac6ee5ea894f53d1a3e744044
Branches: PHP-5.6 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=a29b64fc1029b4121e3e9ff20901c35ad600b4da
Log:
Fixed bug #69159 (Opcache causes problem when passing a variable variable to a function)
Bugs:
https://bugs.php.net/69159
Changed paths:
M NEWS
M ext/opcache/Optimizer/optimize_func_calls.c
A ext/opcache/tests/bug69159.phpt
Diff:
diff --git a/NEWS b/NEWS
index 8c9cf74..ab47726 100644
--- a/NEWS
+++ b/NEWS
@@ -25,6 +25,8 @@
. Fixed bug #68964 (Allowed memory size exhausted with odbc_exec). (Anatol)
- Opcache:
+ . Fixed bug #69159 (Opcache causes problem when passing a variable variable
+ to a function). (Dmitry, Laruence)
. Fixed bug #69125 (Array numeric string as key). (Laruence)
. Fixed bug #69038 (switch(SOMECONSTANT) misbehaves). (Laruence)
diff --git a/ext/opcache/Optimizer/optimize_func_calls.c
b/ext/opcache/Optimizer/optimize_func_calls.c
index 14f8255..886021c 100644
--- a/ext/opcache/Optimizer/optimize_func_calls.c
+++ b/ext/opcache/Optimizer/optimize_func_calls.c
@@ -82,10 +82,10 @@ static void optimize_func_calls(zend_op_array *op_array, zend_persistent_script
case ZEND_FETCH_DIM_FUNC_ARG:
if (call_stack[call - 1].func) {
if (ARG_SHOULD_BE_SENT_BY_REF(call_stack[call - 1].func, (opline->extended_value &
ZEND_FETCH_ARG_MASK))) {
- opline->extended_value = 0;
+ opline->extended_value &= ZEND_FETCH_TYPE_MASK;
opline->opcode -= 9;
} else {
- opline->extended_value = 0;
+ opline->extended_value &= ZEND_FETCH_TYPE_MASK;
opline->opcode -= 12;
}
}
diff --git a/ext/opcache/tests/bug69159.phpt b/ext/opcache/tests/bug69159.phpt
new file mode 100644
index 0000000..d8b953a
--- /dev/null
+++ b/ext/opcache/tests/bug69159.phpt
@@ -0,0 +1,20 @@
+--TEST--
+Bug #69159 (Opcache causes problem when passing a variable variable to a function)
+--INI--
+opcache.enable=1
+opcache.optimization_level=-1
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+$i = 1;
+$x1 = "okey";
+myFunction(${"x$i"});
+
+function myFunction($x) {
+ var_dump($x);
+}
+
+?>
+--EXPECT--
+string(4) "okey"