#44929 [Com]: [PATCH] natsort and natcasesort fail if numbers in strings prepended by 0
| From: | bax_70 at hotmail dot com | Date: | Wed, 08 Apr 2009 15:17:38 +0000 |
| Subject: | #44929 [Com]: [PATCH] natsort and natcasesort fail if numbers in strings prepended by 0 | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-135659@lists.php.net to get a copy of this message | ||
ID: 44929
Comment by: bax_70 at hotmail dot com
Reported By: kae at verens dot com
Status: No Feedback
Bug Type: Arrays related
Operating System: Linux
PHP Version: 5.2.6
Assigned To: rasmus
New Comment:
Excuseme bad example
the right one
$a[0]="00001";
$a[1]="00008";
$a[2]="00005";
$a[3]="000011";
$a[4]="00003";
$a[5]="000014";
natsort($a);
print_r($a);
Array ( [0] => 00001 [3] => 000011 [5] => 000014 [4] => 00003 [2] =>
00005 [1] => 00008 )
Previous Comments:
------------------------------------------------------------------------
[2009-04-08 14:35:44] bax_70 at hotmail dot com
Bad result.
$a[0]=00001;
$a[1]=00008;
$a[2]=00005;
$a[3]=000011;
$a[4]=00003;
$a[5]=000014;
natsort($a);
print_r($a);
Array ( [1] => 0 [0] => 1 [4] => 3 [2] => 5 [3] => 9 [5] => 12 )
------------------------------------------------------------------------
[2008-09-04 01:00:00] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
------------------------------------------------------------------------
[2008-08-27 08:41:25] rasmus@php.net
Checking this further, this patch messes up the order of "0" in an
array that contains negative values like "-123", so it still needs some
work.
------------------------------------------------------------------------
[2008-08-27 07:53:46] rasmus@php.net
I was hoping for some feedback on the patch to hear if it actually
fixes it.
------------------------------------------------------------------------
[2008-08-26 22:57:53] jani@php.net
Rasmus, why don't you commit the patch if it fixes this..?
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/44929
--
Edit this bug report at http://bugs.php.net/?id=44929&edit=1