#18050 [Com]: asort not sorting properly
| From: | long at ku dot edu | Date: | Tue, 20 Aug 2002 20:52:51 +0000 |
| Subject: | #18050 [Com]: asort not sorting properly | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-17346@lists.php.net to get a copy of this message | ||
ID: 18050
Comment by: long@ku.edu
Reported By: bstoppel@ku.edu
Status: Feedback
Bug Type: Arrays related
Operating System: Digital UNIX V4.0F (Rev. 1229)
PHP Version: 4.2.1
New Comment:
I'm the person responsible for PHP on bstoppel's system. I've just
built php4-200208201200 and it looks like asort() is working properly
again. However, I'm seeing this message when running php:
Unaligned access pid=26595 <php> va=0x1400b701c pc=0x12025d930
ra=0x12025d040 inst=0xb4010000
which indicates an unaligned memory access. I couldn't build
zend_API.c without adding an #include "php.h" to get the macro
re-definition of snprintf() but I was told that could be a "bad" thing
to do so perhaps that is causing the unaligned memory accesses...
Previous Comments:
------------------------------------------------------------------------
[2002-06-28 15:15:56] mfischer@php.net
Sterling mentioned something about a cast fix in zend_qsort, please try
http://snaps.php.net/php4-latest.tar.gz
------------------------------------------------------------------------
[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