ID: 40620
Updated by: [EMAIL PROTECTED]
Reported By: mano at easymail dot hu
-Status: Open
+Status: Bogus
Bug Type: Scripting Engine problem
Operating System: Windows XP
PHP Version: 5.2.1
New Comment:
Strict Standards: Only variables should be passed by reference in
/tmp/4.php on line 8
Previous Comments:
------------------------------------------------------------------------
[2007-02-24 20:55:12] mano at easymail dot hu
Description:
------------
I had create variables in my PHP4 application in the function-call
after php4.4 new reference notice came out. It was actually working in
php4.4.4 and the variable could be passed as reference:
test($arr = array("ref"=>1));
I am switching to php5 and neither in php5.1 nor in php5.2 it is
working or giving any error message.
I believe this should work, since the variable creation has precedence
over the function is passed.
Anyhow, if this is another "unsolvable" problem what is so hard to do
engine-wise, at least an error should be dropped like everywhere else
saying "Hello, this will NOT work!"
Reproduce code:
---------------
function test(&$arr){
$arr['ref'] = 2;
}
test($myarr = array('ref'=>1));
$myarr2 = array('ref'=>1);
test($myarr2);
print_r($myarr);
print_r($myarr2);
Expected result:
----------------
Array ( [ref] => 2 ) Array ( [ref] => 2 )
OR
Notice: Only variable could pass by reference
Actual result:
--------------
Array ( [ref] => 1 ) Array ( [ref] => 2 )
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=40620&edit=1