|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2007-03-18 20:25 UTC] wez@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 14:00:01 2025 UTC |
Description: ------------ Because the wrong type is used for the return value from the qsort callback function, the compiler screws up the actual return value, causing the sort to be incorrect. The following diff avoids the bug by explicitly return the "right" values: cvs diff: Diffing . Index: array.c =================================================================== RCS file: /repository/php-src/ext/standard/array.c,v retrieving revision 1.308.2.21.2.25 diff -u -p -r1.308.2.21.2.25 array.c --- array.c 16 Mar 2007 19:38:58 -0000 1.308.2.21.2.25 +++ array.c 18 Mar 2007 20:03:36 -0000 @@ -596,7 +596,7 @@ static int array_user_compare(const void convert_to_long_ex(&retval_ptr); retval = Z_LVAL_P(retval_ptr); zval_ptr_dtor(&retval_ptr); - return retval; + return retval < 0 ? -1 : retval > 0 ? 1 : 0; } else { return 0; }