Bug #18050 Updated: asort not sorting properly

From: Date: Fri, 28 Jun 2002 19:15:56 +0000
Subject: Bug #18050 Updated: asort not sorting properly
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-12440@lists.php.net to get a copy of this message
ID: 18050 Updated by: mfischer@php.net Reported By: bstoppel@ku.edu -Status: Open +Status: Feedback Bug Type: Arrays related Operating System: Digital UNIX V4.0F (Rev. 1229) PHP Version: 4.2.1 New Comment: Sterling mentioned something about a cast fix in zend_qsort, please try http://snaps.php.net/php4-latest.tar.gz Previous Comments: ------------------------------------------------------------------------ [2002-06-28 15:05:22] bstoppel@ku.edu The platform that I am using is 64-bit. BTW - before upgrading to 4.21, we were using 4.06 and the sort function worked fine. ------------------------------------------------------------------------ [2002-06-28 14:37:09] rasmus@php.net Hrm.. On my Linux box your script outputs: c = apple b = banana d = lemon a = orange Are you on a 64-bit platform? I'm looking at the zend_qsort() function but I don't see an obvious mistake. ------------------------------------------------------------------------ [2002-06-28 14:28:17] bstoppel@ku.edu I used the example given in the asort documentation. The result is not correct. Here is the example for your convenience: $fruits = array ("d"=>"lemon", "a"=>"orange", "b"=>"banana", "c"=>"apple"); asort ($fruits); reset ($fruits); while (list ($key, $val) = each ($fruits)) { echo "$key = $val\n"; } The actual output is d = lemon a = orange b = banana c = apple The expected output is c = apple b = banana d = lemon a = orange ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=18050&edit=1

« previous php.bugs (#12440) next »