Skip to content

Commit

Permalink
Bug #55754 - Only variables should be passed by reference for ZEND_SE…
Browse files Browse the repository at this point in the history
…ND_PREFER_REF params
  • Loading branch information
smalyshev committed Oct 16, 2011
1 parent 3e289bb commit 70a6a67
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Zend/zend_compile.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
14 changes: 14 additions & 0 deletions tests/lang/bug55754.phpt
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 70a6a67

Please sign in to comment.