Bug #69159 [Opn]: Opcache causes problem when passing a variable variable to a function
Edit report at https://bugs.php.net/bug.php?id=69159&edit=1
ID: 69159
Updated by: laruence@php.net
Reported by: seb at rootsandrain dot com
Summary: Opcache causes problem when passing a variable
variable to a function
Status: Open
Type: Bug
Package: opcache
Operating System: CentOS
PHP Version: 5.6.6
Block user comment: N
Private report: N
New Comment:
could you verify this fix works?
diff --git a/ext/opcache/Optimizer/optimize_func_calls.c
b/ext/opcache/Optimizer/optimize_func_calls.c
index 14f8255..17136ba 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->opcode -= 9;
+ opline->extended_value = (opline->opcode == ZEND_FETCH_FUNC_ARG)? ZEND_F
ETCH_LOCAL : 0;
+ opline->opcode -= 9;
} else {
- opline->extended_value = 0;
+ opline->extended_value = (opline->opcode == ZEND_FETCH_FUNC_ARG)? ZEND_F
ETCH_LOCAL : 0;
opline->opcode -= 12;
}
}
thanks
Previous Comments:
------------------------------------------------------------------------
[2015-03-02 15:09:06] seb at rootsandrain dot com
Description:
------------
After upgrading from 5.5.22 to 5.6.6 the script failed to operate correctly, churning out
"Notice: undefined variable" errors on the function call line.
Disabling opcache fixes the problem.
Sadly the short version I've posted here doesn't appear to exhibit the problem, and I
don't have time to anonymise the much larger section of code that's been breaking.
Nevertheless, it was 100% the call to "myFunction" that was giving a Notice undefined
variable error.
Test script:
---------------
$i=1;
${"sR{$i}S1"} = 'hello';
${"nR{$i}S1P"} = 'world';
myFunction(${"sR{$i}S1"}, ${"nR{$i}S1P"});
function myFunction($x, $y) {
echo "$x $y";
}
Expected result:
----------------
echos
"hello world"
Actual result:
--------------
Notice: undefined variable
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=69159&edit=1
Thread (4 messages)