diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index f8fe4ef17693a..a9eb91a974444 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -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 */ diff --git a/tests/lang/bug55754.phpt b/tests/lang/bug55754.phpt new file mode 100644 index 0000000000000..c58ec9175af02 --- /dev/null +++ b/tests/lang/bug55754.phpt @@ -0,0 +1,14 @@ +--TEST-- +Bug #55754 (Only variables should be passed by reference for ZEND_SEND_PREFER_REF params) +--FILE-- + "a")); +current(array(0 => "a")); +current($arr); + +echo "DONE"; + +?> +--EXPECT-- +DONE