stas Sun, 16 Oct 2011 00:34:01 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=318137
Log: Bug #55754 - Only variables should be passed by reference for ZEND_SEND_PREFER_REF params Bug: https://bugs.php.net/55754 (Open) Only variables should be passed by reference for ZEND_SEND_PREFER_REF params Changed paths: U php/php-src/branches/PHP_5_4/Zend/zend_compile.c A php/php-src/branches/PHP_5_4/tests/lang/bug55754.phpt U php/php-src/trunk/Zend/zend_compile.c A php/php-src/trunk/tests/lang/bug55754.phpt Modified: php/php-src/branches/PHP_5_4/Zend/zend_compile.c =================================================================== --- php/php-src/branches/PHP_5_4/Zend/zend_compile.c 2011-10-15 23:57:33 UTC (rev 318136) +++ php/php-src/branches/PHP_5_4/Zend/zend_compile.c 2011-10-16 00:34:01 UTC (rev 318137) @@ -2487,7 +2487,7 @@ 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 */ Added: php/php-src/branches/PHP_5_4/tests/lang/bug55754.phpt =================================================================== --- php/php-src/branches/PHP_5_4/tests/lang/bug55754.phpt (rev 0) +++ php/php-src/branches/PHP_5_4/tests/lang/bug55754.phpt 2011-10-16 00:34:01 UTC (rev 318137) @@ -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 Modified: php/php-src/trunk/Zend/zend_compile.c =================================================================== --- php/php-src/trunk/Zend/zend_compile.c 2011-10-15 23:57:33 UTC (rev 318136) +++ php/php-src/trunk/Zend/zend_compile.c 2011-10-16 00:34:01 UTC (rev 318137) @@ -2487,7 +2487,7 @@ 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 */ Added: php/php-src/trunk/tests/lang/bug55754.phpt =================================================================== --- php/php-src/trunk/tests/lang/bug55754.phpt (rev 0) +++ php/php-src/trunk/tests/lang/bug55754.phpt 2011-10-16 00:34:01 UTC (rev 318137) @@ -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
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php