1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 08:12:21 +01:00

Bug #55754 - Only variables should be passed by reference for ZEND_SEND_PREFER_REF params

This commit is contained in:
Stanislav Malyshev
2011-10-16 00:34:01 +00:00
parent 3e289bb0f9
commit 70a6a67c1e
2 changed files with 15 additions and 1 deletions

View File

@@ -2487,7 +2487,7 @@ void zend_do_pass_param(znode *param, zend_uchar op, int offset TSRMLS_DC) /* {{
if (function_ptr) {
if (ARG_MAY_BE_SENT_BY_REF(function_ptr, (zend_uint) offset)) {
if (param->op_type & (IS_VAR|IS_CV)) {
if (param->op_type & (IS_VAR|IS_CV) && original_op != ZEND_SEND_VAL) {
send_by_reference = 1;
if (op == ZEND_SEND_VAR && zend_is_function_or_method_call(param)) {
/* Method call */

14
tests/lang/bug55754.phpt Normal file
View File

@@ -0,0 +1,14 @@
--TEST--
Bug #55754 (Only variables should be passed by reference for ZEND_SEND_PREFER_REF params)
--FILE--
<?php
current($arr = array(0 => "a"));
current(array(0 => "a"));
current($arr);
echo "DONE";
?>
--EXPECT--
DONE