|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2007-02-26 08:09 UTC] tony2001@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Dec 04 03:00:01 2025 UTC |
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 )