Sorting Bug / Wrong behavior?
| From: | John Coggeshall | Date: | Tue, 27 Jul 2004 19:48:28 +0000 |
| Subject: | Sorting Bug / Wrong behavior? | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-11584@lists.php.net to get a copy of this message | ||
Consider the following:
<?php $a = array('a', 'b', 'c', 'a'=>0,
'b'=>1, 'c'=>2);
sort($a);
print_r($a);
?>
This produces a bogus output:
Array
(
[0] => a
[1] => b
[2] => 0
[3] => c
[4] => 1
[5] => 2
)
Notice how 0 and c are switched incorrectly. Attached is a patch to
zend_operators.c that fixes it.