Bug #17449 Updated: sort() does not work

From: Date: Mon, 27 May 2002 14:39:25 +0000
Subject: Bug #17449 Updated: sort() does not work
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-8667@lists.php.net to get a copy of this message
ID: 17449 Updated by: nohn@php.net Reported By: nohn@php.net Status: Open Bug Type: Arrays related Operating System: Digital UNIX V4.0G (Rev. 1530) PHP Version: 4.2.0 New Comment: This would be great. I tested it on PHP 4.2.1 on Win2k, it worked fine. So it seems to be a platform specific problem. I can help you with testing other versions on that machine/fixing the bug. It would be nice, if some of the core developers (maybe Andrei, Andi, Rasmus, Zeev, Jeroen, Derick - these are the people who did most changes in the last months on array.c) could give us some information on what files may affect this. I've found that between 4.0.5 and 4.2.1 nearly the whole source for PHP_FUNCTION(sort) has changed. Previous Comments: ------------------------------------------------------------------------ [2002-05-27 09:46:54] michael.mauch@gmx.de On Digital UNIX V4.0G (Rev. 1530), sort() does not work with PHP 4.2.1, either. It does work with PHP 4.0.5 on that same platform. Should I try PHP 4.1.x to see where things started to go wrong? ------------------------------------------------------------------------ [2002-05-27 06:38:51] sander@php.net Reclassified. ------------------------------------------------------------------------ [2002-05-27 06:31:15] nohn@php.net Example script: <?php function cmp ($x, $y){ $c = (int) $x; $d = (int) $y; if($c == $d) return 0; return ($c > $d) ? 1 : -1; } $arr = array(1, 3, 2, 10, 9); //print_r($arr); var_dump($arr); sort($arr, SORT_NUMERIC); var_dump($arr); //reset($arr); echo "<br><br>"; print_r($arr); /*srand((float)microtime()*1000000); shuffle($arr); echo "<br><br>"; print_r($arr);*/ ?> ######################################################## PHP Version 4.0.6 SunOS xxxxxxx 5.7 Generic_106541-15 sun4us sparc FJSV,GPUS './configure' '--prefix=/usr/local' '--with-apache=/usr/local/Apachetoolbox-1.5.34/apache_1.3.20' '--enable-exif' '--enable-track-vars' '--with-calendar=shared' '--enable-safe-mode' '--enable-magic-quotes' '--enable-trans-sid' '--enable-wddx' '--enable-ftp' '--with-oci8' '--with-mysql=/usr/local/mysql' ######################################################## array(5) { [0]=> int(1) [1]=> int(3) [2]=> int(2) [3]=> int(10) [4]=> int(9) } array(5) { [0]=> int(1) [1]=> int(2) [2]=> int(3) [3]=> int(9) [4]=> int(10) } Array ( [0] => 1 [1] => 2 [2] => 3 [3] => 9 [4] => 10 ) So sorting works fine on PHP 4.0.6 on Solaris ######################################################## PHP Version 4.2.0 OSF1 xxxxx V4.0 1530 alpha './configure' '--prefix=/usr/local' '--with-apache=/usr/local/Apachetoolbox-1.5.56/apache_1.3.24' '--enable-exif' '--enable-track-vars' '--with-calendar=shared' '--enable-safe-mode' '--enable-magic-quotes' '--enable-trans-sid' '--enable-wddx' '--enable-ftp' '--with-openssl=/usr/local' '--with-oci8=/appl/oracle/product/8.1.6' '--with-mysql=/usr/local/mysql' ######################################################## array(5) { [0]=> int(1) [1]=> int(3) [2]=> int(2) [3]=> int(10) [4]=> int(9) } array(5) { [0]=> int(1) [1]=> int(3) [2]=> int(2) [3]=> int(10) [4]=> int(9) } Array ( [0] => 1 [1] => 3 [2] => 2 [3] => 10 [4] => 9 ) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=17449&edit=1

« previous php.bugs (#8667) next »