ID:               49698
 Updated by:       ras...@php.net
 Reported By:      sander dot vink at procurios dot nl
-Status:           Open
+Status:           Closed
 Bug Type:         Strings related
 Operating System: Linux
 PHP Version:      5.2.11
 New Comment:

I have fixed this regression, although if you have an integer prefix on
your strings, I am not sure why you are using strnatcasecmp on those.


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

[2009-09-28 13:29:54] s...@php.net

Automatic comment from SVN on behalf of rasmus
Revision: http://svn.php.net/viewvc/?view=revision&revision=288896
Log: Fix for bug #49698

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

[2009-09-28 11:51:42] sander dot vink at procurios dot nl

To be a little more specific, I used the latest snapshot of PHP 5.3 
(shown as "PHP 5.3.2-dev").

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

[2009-09-28 11:49:09] sander dot vink at procurios dot nl

I have tried the latest snapshot again (Built on: Sep 28, 2009 10:30 
UTC) and the expected result is still not acquired.

Are you sure it is fixed in PHP 5.3-HEAD, and if so, when will it be 
available as either snapshot or release?

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

[2009-09-28 11:22:53] sjo...@php.net

This seems to be solved already in PHP 5.3-HEAD.

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

[2009-09-28 07:56:04] sander dot vink at procurios dot nl

Description:
------------
We use the strnatcasecmp()-function to get a "natural order" in our 
lists of items. Up until PHP 5.2.9 it worked like a charm, but since we

upgraded to PHP 5.2.11 the order seems to have been changed.

The natural order is used in our case to support the sorting of items 
that have been prefixed with numbers (0, 1, 2, etc). This is exactly 
where the problem arises: 0 should be "sorted" before 1, but this is no

longer the case.

This problem also occurs in the latest snapshot of PHP 5.3

Reproduce code:
---------------
<?php

$string1 = '0 Foo';
$string2 = '1 Bar';

var_dump(strnatcasecmp($string1, $string2));

Expected result:
----------------
int(-1)

Actual result:
--------------
int(1)


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


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

Reply via email to