ID:               40848
 Updated by:       [EMAIL PROTECTED]
 Reported By:      [EMAIL PROTECTED]
-Status:           Open
+Status:           Closed
 Bug Type:         Arrays related
 Operating System: Solaris
 PHP Version:      5.2.1
 New Comment:

This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.




Previous Comments:
------------------------------------------------------------------------

[2007-03-18 20:12:02] [EMAIL PROTECTED]

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;
        }




------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=40848&edit=1

Reply via email to