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:
@@ -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
14
tests/lang/bug55754.phpt
Normal 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
|
||||
Reference in New Issue
Block a user