#37917 [Opn]: Original Array modified after copy

2006-07-04 Thread andrea dot busia at axis-sv dot it
 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:
---



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


#37917 [Opn]: Original Array modified after copy

2006-06-26 Thread andrea dot busia at axis-sv dot it
 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:

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


Previous Comments:


[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:
---



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