ID:               37917
 User updated by:  andrea dot busia at axis-sv dot it
 Reported By:      andrea dot busia at axis-sv dot it
 Status:           Open
 Bug Type:         Arrays related
 Operating System: Linux / WinXp
 PHP Version:      5.1.4
 New Comment:

No news? This bug is affecting many script and I haven't a workaround.
Is's a critical bug.

Thanks
Andrea Busia


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

[2006-06-26 12:55:36] andrea dot busia at axis-sv dot it

Because for a mistake "Actual result" had to be "Expected result" and
"Expected result" had to be "Actual result".

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

[2006-06-26 12:52:10] andrea dot busia at axis-sv dot it

Description:
------------
First problem: If I Create an array setting an element to a string and
another element as a reference to the first, then copy the array into
an other variable, if i modify the second variable also the original
array is modified.

Second problem:
why the second code line ($a[0]="foo";) produces
  [0]=>
  &string(3) "foo"

instead of
  [0]=>
  string(3) "foo"

Thanks
Andrea Busia

Reproduce code:
---------------
<?
$a=array();
$a[0]="foo";
$a[1] =& $a[0];
var_dump($a);
$b=$a;
$b[0]="bar";
var_dump($a);
?>


Expected result:
----------------
array(2) {
  [0]=>
  string(3) "foo"
  [1]=>
  &string(3) "foo"
}
array(2) {
  [0]=>
  string(3) "foo"
  [1]=>
  &string(3) "foo"
}


Actual result:
--------------
array(2) {
  [0]=>
  &string(3) "foo"
  [1]=>
  &string(3) "foo"
}
array(2) {
  [0]=>
  &string(3) "bar"
  [1]=>
  &string(3) "bar"
}



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


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

Reply via email to