Skip to content

Commit a29b64f

Browse files
committed
Fixed bug #69159 (Opcache causes problem when passing a variable variable to a function)
1 parent 6183408 commit a29b64f

File tree

3 files changed

+24
-2
lines changed

3 files changed

+24
-2
lines changed

NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525
. Fixed bug #68964 (Allowed memory size exhausted with odbc_exec). (Anatol)
2626

2727
- Opcache:
28+
. Fixed bug #69159 (Opcache causes problem when passing a variable variable
29+
to a function). (Dmitry, Laruence)
2830
. Fixed bug #69125 (Array numeric string as key). (Laruence)
2931
. Fixed bug #69038 (switch(SOMECONSTANT) misbehaves). (Laruence)
3032

ext/opcache/Optimizer/optimize_func_calls.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,10 @@ static void optimize_func_calls(zend_op_array *op_array, zend_persistent_script
8282
case ZEND_FETCH_DIM_FUNC_ARG:
8383
if (call_stack[call - 1].func) {
8484
if (ARG_SHOULD_BE_SENT_BY_REF(call_stack[call - 1].func, (opline->extended_value & ZEND_FETCH_ARG_MASK))) {
85-
opline->extended_value = 0;
85+
opline->extended_value &= ZEND_FETCH_TYPE_MASK;
8686
opline->opcode -= 9;
8787
} else {
88-
opline->extended_value = 0;
88+
opline->extended_value &= ZEND_FETCH_TYPE_MASK;
8989
opline->opcode -= 12;
9090
}
9191
}

ext/opcache/tests/bug69159.phpt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
--TEST--
2+
Bug #69159 (Opcache causes problem when passing a variable variable to a function)
3+
--INI--
4+
opcache.enable=1
5+
opcache.optimization_level=-1
6+
--SKIPIF--
7+
<?php require_once('skipif.inc'); ?>
8+
--FILE--
9+
<?php
10+
$i = 1;
11+
$x1 = "okey";
12+
myFunction(${"x$i"});
13+
14+
function myFunction($x) {
15+
var_dump($x);
16+
}
17+
18+
?>
19+
--EXPECT--
20+
string(4) "okey"

0 commit comments

Comments
 (0)