ID:               30587
 Updated by:       [EMAIL PROTECTED]
 Reported By:      ian_mclaughlin at blueyonder dot co dot uk
-Status:           Analyzed
+Status:           Closed
 Bug Type:         Arrays related
 Operating System: Win32
 PHP Version:      4.3.9


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

[2004-11-19 17:57:52] [EMAIL PROTECTED]

This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.

Yes, I was wrong, sorry.
This is fixed by now.

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

[2004-11-16 11:44:21] ian_mclaughlin at blueyonder dot co dot uk

Thanks for your response. 

Variables (master_A and master_B) change even though I have performed
no operation on them since assignment. All the documentation I can find
does not support this behaviour. If this actually is the expected
behaviour, please explain why.

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

[2004-10-27 20:09:56] ian_mclaughlin at blueyonder dot co dot uk

Description:
------------
this code gives the impression that array assignment is actually done
by pointer sharing, when it should be done by copying.

Reproduce code:
---------------
<?php
//
$master_A=array(1,2,4,3);
$master_B=array(1,3,2,4);
$A = $master_A;
$B = $master_B;
        echo"<br/>BEFORE MULTISORT";
        echo"<br/>master_A<br/>";
        print_r($master_A);
        echo"<br/>master_B<br/>";
        print_r($master_B);
array_multisort($A, $B); 
        echo"<br/>AFTER MULTISORT";
        echo"<br/>master_A<br/>";
        print_r($master_A);
        echo"<br/>master_B<br/>";
        print_r($master_B);
?>

Expected result:
----------------
BEFORE MULTISORT
master_A
Array ( [0] => 1 [1] => 2 [2] => 4 [3] => 3 )
master_B
Array ( [0] => 1 [1] => 3 [2] => 2 [3] => 4 )
AFTER MULTISORT
master_A
Array ( [0] => 1 [1] => 2 [2] => 4 [3] => 3 )
master_B
Array ( [0] => 1 [1] => 3 [2] => 2 [3] => 4 )


Actual result:
--------------
BEFORE MULTISORT
master_A
Array ( [0] => 1 [1] => 2 [2] => 4 [3] => 3 )
master_B
Array ( [0] => 1 [1] => 3 [2] => 2 [3] => 4 )
AFTER MULTISORT
master_A
Array ( [0] => 1 [1] => 2 [2] => 3 [3] => 4 )
master_B
Array ( [0] => 1 [1] => 3 [2] => 4 [3] => 2 )


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


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

Reply via email to