cvs: /php4/ext/standard array.c

From: Date: Sun, 21 Nov 1999 17:14:10 +0000
Subject: cvs: /php4/ext/standard array.c
Groups: php.version4 
Request: Send a blank email to php-version4+get-6624@lists.php.net to get a copy of this message
thies Sun Nov 21 12:14:10 1999 EDT Modified files: /php4/ext/standard array.c Log: convert_to_long() after compare_function() destroys float-compares! Index: php4/ext/standard/array.c diff -u php4/ext/standard/array.c:1.9 php4/ext/standard/array.c:1.10 --- php4/ext/standard/array.c:1.9 Sun Nov 21 09:06:30 1999 +++ php4/ext/standard/array.c Sun Nov 21 12:13:39 1999 @@ -154,14 +154,25 @@ return 0; } + if (result.type == IS_DOUBLE) { + if (result.value.dval < 0) { + return -1; + } else if (result.value.dval > 0) { + return 1; + } else { + return 0; + } + } + convert_to_long(&result); + if (result.value.lval < 0) { return -1; } else if (result.value.lval > 0) { return 1; - } else { - return 0; - } + } + + return 0; } static int array_reverse_key_compare(const void *a, const void *b) @@ -251,14 +262,25 @@ return 0; } + if (result.type == IS_DOUBLE) { + if (result.value.dval < 0) { + return -1; + } else if (result.value.dval > 0) { + return 1; + } else { + return 0; + } + } + convert_to_long(&result); + if (result.value.lval < 0) { return -1; } else if (result.value.lval > 0) { return 1; - } else { - return 0; - } + } + + return 0; } static int array_reverse_data_compare(const void *a, const void *b)

« previous php.version4 (#6624) next »