#44929 [NoF->Csd]: [PATCH] natsort and natcasesort fail if numbers in strings prepended by 0
| From: | rasmus@php.net | Date: | Wed, 08 Apr 2009 18:11:28 +0000 |
| Subject: | #44929 [NoF->Csd]: [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-135663@lists.php.net to get a copy of this message | ||
ID: 44929
Updated by: rasmus@php.net
Reported By: kae at verens dot com
-Status: No Feedback
+Status: Closed
Bug Type: Arrays related
Operating System: Linux
PHP Version: 5.2.6
Assigned To: rasmus
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.
Fixed in CVS
Previous Comments:
------------------------------------------------------------------------
[2009-04-08 15:17:37] bax_70 at hotmail dot com
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 )
------------------------------------------------------------------------
[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.
------------------------------------------------------------------------
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