From:             
Operating system: Linux Ubuntu 10.04
PHP version:      5.3.2
Package:          Scripting Engine problem
Bug Type:         Bug
Bug description:Functions cannot return an argument passed by reference as 
reference

Description:
------------
PHP does not behave as expected when passing arguments by reference into a


function that are passed out again by reference.



IMO, the below test script should behave equivalently to the following code


(which produces the expected result):



$b = 'foobar';

$a =& $b;

$c =& $a;

$c[2] = 'z';



var_dump($c);

var_dump($b);

Test script:
---------------
function &ref(&$a)

{

  return $a;

}



$b = 'foobar';

$c = ref($b);

$c[2] = 'z';

Expected result:
----------------
string 'fozbar' (length=6)

string 'fozbar' (length=6)

Actual result:
--------------
string 'fozbar' (length=6)

string 'foobar' (length=6)

-- 
Edit bug report at http://bugs.php.net/bug.php?id=52133&edit=1
-- 
Try a snapshot (PHP 5.2):            
http://bugs.php.net/fix.php?id=52133&r=trysnapshot52
Try a snapshot (PHP 5.3):            
http://bugs.php.net/fix.php?id=52133&r=trysnapshot53
Try a snapshot (trunk):              
http://bugs.php.net/fix.php?id=52133&r=trysnapshottrunk
Fixed in SVN:                        
http://bugs.php.net/fix.php?id=52133&r=fixed
Fixed in SVN and need be documented: 
http://bugs.php.net/fix.php?id=52133&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=52133&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=52133&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=52133&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=52133&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=52133&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=52133&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=52133&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=52133&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=52133&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=52133&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=52133&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=52133&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=52133&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=52133&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=52133&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=52133&r=mysqlcfg

Reply via email to