ID: 17449 Updated by: [EMAIL PROTECTED] Reported By: [EMAIL PROTECTED] Status: Open Bug Type: Arrays related Operating System: Digital UNIX V4.0G (Rev. 1530) PHP Version: 4.2.1 New Comment:
Bug #17257 seems to be the same problem ("Digital UNIX OSF/1" is the old name of "Compaq Tru64"). People there found that all sort functions broke with PHP-4.2.0RC1, I can confirm this now. Smallest test program: <?php $a = array(9,7,3,5); sort($a); print_r($a); ?> Output: Array ( [0] => 9 [1] => 7 [2] => 3 [3] => 5 ) It's not compiler-related, both gcc-2.95.2 and Compac C V6.3-129 give the same results. Maybe endianess-related (the Compaq machine have Alpha processors)? If somebody more clueful wants to take a look at this problem: Compaq provides free test accounts (not only with Tru64, but also with FreeBSD, NetBSD and Linux), see <http://www.testdrive.compaq.com/>. I compiled PHP-4.2.0RC1 there on FreeBSD/Alpha, and gcc-2.95.3 gives lots of warnings: *** The -O2 flag TRIGGERS KNOWN OPTIMIZER BUGS ON THIS PLATFORM But even with CFLAGS="-O0 -g" sort() does not sort at all. On FreeBSD/Intel it does work, so it probably is an endianess problem. Previous Comments: ------------------------------------------------------------------------ [2002-05-27 14:29:54] [EMAIL PROTECTED] Well, the script runs fine under my IRIX64 6.5.16m on mod_php/Apache 1.3.24 but not when using a 64bit cgi binary with Apache2. Case 1 http://sgi.takenet.de/php/sort.php Case 2 http://sgi.takenet.de:8080/php/sort.php ------------------------------------------------------------------------ [2002-05-27 11:11:05] [EMAIL PROTECTED] I checked some older versions: until PHP-4.1.2, sort() was fine. I didn't check 4.2.0RC*, yet, but will do so tomorrow. ------------------------------------------------------------------------ [2002-05-27 10:44:43] [EMAIL PROTECTED] Updated version according to Michaels tests. ------------------------------------------------------------------------ [2002-05-27 10:39:24] [EMAIL PROTECTED] 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. ------------------------------------------------------------------------ [2002-05-27 09:46:54] [EMAIL PROTECTED] 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? ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/17449 -- Edit this bug report at http://bugs.php.net/?id=17449&edit=1