iliaa Wed Jul 14 21:26:03 2004 EDT Added files: /php-src/ext/standard/tests/strings bug29075.phpt
Modified files: /php-src/ext/standard strnatcmp.c Log: Fixed Bug #29075 (strnatcmp() incorrectly handles whitespace). # Original Patch by: [EMAIL PROTECTED] http://cvs.php.net/diff.php/php-src/ext/standard/strnatcmp.c?r1=1.9&r2=1.10&ty=u Index: php-src/ext/standard/strnatcmp.c diff -u php-src/ext/standard/strnatcmp.c:1.9 php-src/ext/standard/strnatcmp.c:1.10 --- php-src/ext/standard/strnatcmp.c:1.9 Wed Apr 16 17:10:29 2003 +++ php-src/ext/standard/strnatcmp.c Wed Jul 14 21:26:03 2004 @@ -38,7 +38,7 @@ #if 0 static char const *version UNUSED = - "$Id: strnatcmp.c,v 1.9 2003/04/16 21:10:29 moriyoshi Exp $"; + "$Id: strnatcmp.c,v 1.10 2004/07/15 01:26:03 iliaa Exp $"; #endif /* {{{ compare_right */ @@ -153,13 +153,13 @@ return +1; ++ap; ++bp; - if (ap == aend && bp == bend) + if (ap >= aend && bp >= bend) /* The strings compare the same. Perhaps the caller will want to call strcmp to break the tie. */ return 0; - else if (ap == aend) + else if (ap >= aend) return -1; - else if (bp == bend) + else if (bp >= bend) return 1; } } http://cvs.php.net/co.php/php-src/ext/standard/tests/strings/bug29075.phpt?r=1.1&p=1 Index: php-src/ext/standard/tests/strings/bug29075.phpt +++ php-src/ext/standard/tests/strings/bug29075.phpt --TEST-- Bug #29075 (strnatcmp() incorrectly handles whitespace) --FILE-- <?php var_dump( strnatcmp('foo ', 'foo '), strnatcmp('foo', 'foo'), strnatcmp(' foo', ' foo') ); ?> --EXPECT-- int(0) int(0) int(0) -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php