Skip to content

Commit 2269b18

Browse files
committed
Add missing string cast for non-cv var fetches
1 parent 69a4b13 commit 2269b18

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
--TEST--
2+
Variable with boolean name
3+
--FILE--
4+
<?php
5+
6+
${true} = 42;
7+
var_dump(${true});
8+
var_dump(${'1'});
9+
10+
?>
11+
--EXPECT--
12+
int(42)
13+
int(42)

Zend/zend_compile.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1978,6 +1978,9 @@ static zend_op *zend_compile_simple_var_no_cv(znode *result, zend_ast *ast, uint
19781978
}
19791979

19801980
zend_compile_expr(&name_node, name_ast);
1981+
if (name_node.op_type == IS_CONST) {
1982+
convert_to_string(&name_node.u.constant);
1983+
}
19811984

19821985
opline = zend_emit_op(result, ZEND_FETCH_R, &name_node, NULL);
19831986

0 commit comments

Comments
 (0)