From:             mano at easymail dot hu
Operating system: Windows XP
PHP version:      5.2.1
PHP Bug Type:     Scripting Engine problem
Bug description:  Passing by reference made on the fly does not change and no 
error reported

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 bug report at http://bugs.php.net/?id=40620&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=40620&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=40620&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=40620&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=40620&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=40620&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=40620&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=40620&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=40620&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=40620&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=40620&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=40620&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=40620&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=40620&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=40620&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=40620&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=40620&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=40620&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=40620&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=40620&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=40620&r=mysqlcfg

Reply via email to