php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #46280 uasort bug
Submitted: 2008-10-12 12:49 UTC Modified: 2008-10-14 21:42 UTC
From: goodfriends0092004 at yahoo dot com Assigned:
Status: Not a bug Package: Unknown/Other Function
PHP Version: 5.2.6 OS: windows
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: goodfriends0092004 at yahoo dot com
New email:
PHP Version: OS:

 

 [2008-10-12 12:49 UTC] goodfriends0092004 at yahoo dot com
Description:
------------
i found a bug of uasort function

Reproduce code:
---------------
$x = array(1,1,1,1,1,1,1,'a'=>1);
uasort($x,create_function('$a,$b', 'return 0;'));
var_dump($x);

Expected result:
----------------
array
  5 => int 1
  6 => int 1
  'a' => int 1
  4 => int 1
  3 => int 1
  1 => int 1
  2 => int 1
  0 => int 1




Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-10-14 21:42 UTC] johannes@php.net
I guess you're report is about 'a'=>1 not being the last element anymore, but as the values are the same the order is "random" depending on the sort implementation.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sat Dec 27 17:00:01 2025 UTC