#49797 [NEW]: strnatcmp and strings ending with 0
| From: | j dot henge-ernst at interexa dot de | Date: | Tue, 06 Oct 2009 21:55:55 +0000 |
| Subject: | #49797 [NEW]: strnatcmp and strings ending with 0 | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-143342@lists.php.net to get a copy of this message | ||
From: j dot henge-ernst at interexa dot de
Operating system: linux
PHP version: 5.3.0
PHP Bug Type: Strings related
Bug description: strnatcmp and strings ending with 0
Description:
------------
strnatcmp returns wrong results when one string is ending with a zero. At
leat in php 5.2.9 the expected result is returned. In php 5.3.0 and 5.2.10
it is broken.
Reproduce code:
---------------
<?php
echo strnatcmp('b0', 'b0$') . "\n";
echo strnatcmp('b1', 'b1$') . "\n";
echo strnatcmp('b0x', 'b0x$') . "\n";
echo strnatcasecmp('b0', 'B0$') . "\n";
echo strnatcasecmp('b1', 'B1$') . "\n";
echo strnatcasecmp('b0x', 'B0x$') . "\n";
Expected result:
----------------
-1
-1
-1
-1
-1
-1
Actual result:
--------------
1
-1
-1
1
-1
-1
--
Edit bug report at http://bugs.php.net/?id=49797&edit=1
--
Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=49797&r=trysnapshot52
Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=49797&r=trysnapshot53
Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=49797&r=trysnapshot60
Fixed in SVN: http://bugs.php.net/fix.php?id=49797&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=49797&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=49797&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=49797&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=49797&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=49797&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=49797&r=support
Expected behavior: http://bugs.php.net/fix.php?id=49797&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=49797&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=49797&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=49797&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=49797&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=49797&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=49797&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=49797&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=49797&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=49797&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=49797&r=mysqlcfg