From: sander dot vink at procurios dot nl Operating system: Linux PHP version: 5.2.11 PHP Bug Type: Strings related Bug description: Unexpected change in strnatcasecmp()
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 bug report at http://bugs.php.net/?id=49698&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=49698&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=49698&r=trysnapshot53 Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=49698&r=trysnapshot60 Fixed in SVN: http://bugs.php.net/fix.php?id=49698&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=49698&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=49698&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=49698&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=49698&r=needscript Try newer version: http://bugs.php.net/fix.php?id=49698&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=49698&r=support Expected behavior: http://bugs.php.net/fix.php?id=49698&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=49698&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=49698&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=49698&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=49698&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=49698&r=dst IIS Stability: http://bugs.php.net/fix.php?id=49698&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=49698&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=49698&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=49698&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=49698&r=mysqlcfg