ID:               27381
 Comment by:       postings-php-bug at hans-spath dot de
 Reported By:      abk at avatartechnology dot com
 Status:           Feedback
 Bug Type:         Arrays related
 Operating System: Win 2K pro
 PHP Version:      4.3.4
 New Comment:

I can't reproduce this under Windows XP (CLI) or Linux (Apache2
module). Version 4.3.4.


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

[2004-02-24 14:26:34] [EMAIL PROTECTED]

Please try using this CVS snapshot:

  http://snaps.php.net/php4-STABLE-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php4-win32-STABLE-latest.zip

Works fine for me...

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

[2004-02-24 13:25:56] abk at avatartechnology dot com

Description:
------------
Unsetting an element of an array unsets that element in copies of the
array. This does not happen if you change the array or its copy in some
other way after making the copy and before doing the unset. I haven't
tested whether this affects other non-atomic types like objects, but it
wouldn't surprise me if it does.



My educated guess is there is some copy-on-write optomization that
(wrongly) does not consider "unset" to be a write.

Reproduce code:
---------------
$x = array(1,2);

$y = $x;

# uncommenting the next line "fixes" the bug:

#$x[0] = $x[0];

unset($x[0]);

print_r($y);

Expected result:
----------------
Array(0=>1,1=>2)

Actual result:
--------------
Array(1=>2)


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


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

Reply via email to