#49797 [Opn->Fbk]: strnatcmp and strings ending with 0

From: Date: Wed, 07 Oct 2009 08:13:11 +0000
Subject: #49797 [Opn->Fbk]: strnatcmp and strings ending with 0
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-143344@lists.php.net to get a copy of this message
ID: 49797 Updated by: pajoye@php.net Reported By: j dot henge-ernst at interexa dot de -Status: Open +Status: Feedback Bug Type: Strings related Operating System: linux PHP Version: 5.3.0 New Comment: Pls see #44929 and try a snapshot as well. Previous Comments: ------------------------------------------------------------------------ [2009-10-06 21:55:55] j dot henge-ernst at interexa dot de 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 this bug report at http://bugs.php.net/?id=49797&edit=1

« previous php.bugs (#143344) next »