PHP 4.0 Bug #2191: Function max does not work...

From: Date: Mon, 30 Aug 1999 13:22:00 +0000
Subject: PHP 4.0 Bug #2191: Function max does not work...
Groups: php.dev 
Request: Send a blank email to php-dev+get-10347@lists.php.net to get a copy of this message
From: oliver@billix.franken.de Operating system: linux PHP version: 4.0 Latest CVS (30/08/1999) PHP Bug Type: Misbehaving function Bug description: Function max does not work... Simple script to reproduce: --------------------------- <?php print max(20.0,10.0,30.0); ?> prints 20 instead of 30. (In fact, it always prints the first value) Here is a patch which worked for me, but I'm not sure whether it's the correct way of fixing it: *** basic_functions.c Mon Aug 30 15:05:51 1999 --- basic_functions.c.org Sun Aug 29 13:05:46 1999 *************** *** 1388,1395 **** min = args[0]; for (i=1; i<ARG_COUNT(ht); i++) { ! compare_function(&result, min, args[i]); ! if (result.value.lval > 0) { min = args[i]; } } --- 1388,1395 ---- min = args[0]; for (i=1; i<ARG_COUNT(ht); i++) { ! is_smaller_function(&result, args[i], min); ! if (result.value.lval == 1) { min = args[i]; } } *************** *** 1439,1446 **** max = args[0]; for (i=1; i<ARG_COUNT(ht); i++) { ! compare_function(&result, max, args[i]); ! if (result.value.lval < 0) { max = args[i]; } } --- 1439,1446 ---- max = args[0]; for (i=1; i<ARG_COUNT(ht); i++) { ! is_smaller_or_equal_function(&result, args[i], max); ! if (result.value.lval == 0) { max = args[i]; } }

« previous php.dev (#10347) next »