diff options
author | Stanislav Malyshev <stas@php.net> | 2011-10-16 00:34:01 +0000 |
---|---|---|
committer | Stanislav Malyshev <stas@php.net> | 2011-10-16 00:34:01 +0000 |
commit | 05c5c8958ea59ea11f3709acab39503ba9674d0b (patch) | |
tree | aaa6303d2e13dbf029c7a1a7997e2ac6a3ce729b | |
parent | 0a1cc5f01cbcae5f1ed9183387d0b37e70210b68 (diff) | |
download | php-git-05c5c8958ea59ea11f3709acab39503ba9674d0b.tar.gz |
Bug #55754 - Only variables should be passed by reference for ZEND_SEND_PREFER_REF params
-rw-r--r-- | Zend/zend_compile.c | 2 | ||||
-rw-r--r-- | tests/lang/bug55754.phpt | 14 |
2 files changed, 15 insertions, 1 deletions
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index f8fe4ef176..a9eb91a974 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 0000000000..c58ec9175a --- /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-- +<?php + +current($arr = array(0 => "a")); +current(array(0 => "a")); +current($arr); + +echo "DONE"; + +?> +--EXPECT-- +DONE |