ID:               49698
 Comment by:       sander dot vink at procurios dot nl
 Reported By:      sander dot vink at procurios dot nl
 Status:           Open
 Bug Type:         Strings related
 Operating System: Linux
 PHP Version:      5.2.11
 New Comment:

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?


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

[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