ID:               48137
 Updated by:       [email protected]
 Reported By:      mike at clove dot com
-Status:           Open
+Status:           Bogus
 Bug Type:         Arrays related
 Operating System: Mac OS X 10.5.6
 PHP Version:      5.2.9
 New Comment:

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

Nah, this is fine. It doesn't modify the array. The & just shows that
the is_ref bit on the zval container that contains the int(1) value is
set.


Previous Comments:
------------------------------------------------------------------------

[2009-05-03 17:01:04] mike at clove dot com

Description:
------------
Assigning reference to an array element appears to modify the
array element rather than simply creating a reference to it.
This is surprising, to say the least.

At least I think this is a bug and couldn't find anything with the same
behavior and such minimal code.


Reproduce code:
---------------
$a = array(1,2);
$r =& $a[0];
var_dump($a);


Expected result:
----------------
array(2) {
  [0]=>
  int(1)
  [1]=>
  int(2)
}


Actual result:
--------------
array(2) {
  [0]=>
  &int(1)
  [1]=>
  int(2)
}



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=48137&edit=1

Reply via email to