mirror of
https://github.com/php/php-src.git
synced 2026-03-29 19:52:20 +02:00
Merge branch 'PHP-7.0'
Conflicts: Zend/zend_compile.c
This commit is contained in:
23
Zend/tests/bug71529.phpt
Normal file
23
Zend/tests/bug71529.phpt
Normal file
@@ -0,0 +1,23 @@
|
||||
--TEST--
|
||||
Bug #71529: Variable references on array elements don't work when using count
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$a = [1];
|
||||
$a[] = &$a[out(count($a) - 1)];
|
||||
var_dump($a);
|
||||
|
||||
function out($what) {
|
||||
var_dump($what);
|
||||
return $what;
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
int(0)
|
||||
array(2) {
|
||||
[0]=>
|
||||
&int(1)
|
||||
[1]=>
|
||||
&int(1)
|
||||
}
|
||||
@@ -2887,14 +2887,17 @@ void zend_compile_assign_ref(znode *result, zend_ast *ast) /* {{{ */
|
||||
|
||||
znode target_node, source_node;
|
||||
zend_op *opline;
|
||||
uint32_t offset;
|
||||
|
||||
if (is_this_fetch(target_ast)) {
|
||||
zend_error_noreturn(E_COMPILE_ERROR, "Cannot re-assign $this");
|
||||
}
|
||||
zend_ensure_writable_variable(target_ast);
|
||||
|
||||
zend_compile_var(&target_node, target_ast, BP_VAR_W);
|
||||
zend_compile_var(&source_node, source_ast, BP_VAR_W);
|
||||
offset = zend_delayed_compile_begin();
|
||||
zend_delayed_compile_var(&target_node, target_ast, BP_VAR_W);
|
||||
zend_delayed_compile_var(&source_node, source_ast, BP_VAR_W);
|
||||
zend_delayed_compile_end(offset);
|
||||
|
||||
if (source_node.op_type != IS_VAR && zend_is_call(source_ast)) {
|
||||
zend_error_noreturn(E_COMPILE_ERROR, "Cannot use result of built-in function in write context");
|
||||
|
||||
Reference in New Issue
Block a user