iliaa           Wed Jul 14 21:46:28 2004 EDT

  Added files:                 (Branch: PHP_4_3)
    /php-src/ext/standard/tests/strings bug29075.phpt 

  Modified files:              
    /php-src/ext/standard       strnatcmp.c 
    /php-src    NEWS 
  Log:
  MFH: Fixed Bug #29075 (strnatcmp() incorrectly handles whitespace).
  
  
http://cvs.php.net/diff.php/php-src/ext/standard/strnatcmp.c?r1=1.8.4.1&r2=1.8.4.2&ty=u
Index: php-src/ext/standard/strnatcmp.c
diff -u php-src/ext/standard/strnatcmp.c:1.8.4.1 
php-src/ext/standard/strnatcmp.c:1.8.4.2
--- php-src/ext/standard/strnatcmp.c:1.8.4.1    Wed Apr 16 17:11:04 2003
+++ php-src/ext/standard/strnatcmp.c    Wed Jul 14 21:46:27 2004
@@ -38,7 +38,7 @@
 
 #if 0
 static char const *version UNUSED =
-    "$Id: strnatcmp.c,v 1.8.4.1 2003/04/16 21:11:04 moriyoshi Exp $";
+    "$Id: strnatcmp.c,v 1.8.4.2 2004/07/15 01:46:27 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/diff.php/php-src/NEWS?r1=1.1247.2.700&r2=1.1247.2.701&ty=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.1247.2.700 php-src/NEWS:1.1247.2.701
--- php-src/NEWS:1.1247.2.700   Tue Jul 13 15:33:35 2004
+++ php-src/NEWS        Wed Jul 14 21:46:28 2004
@@ -6,6 +6,7 @@
   for doing performance stats without warnings in server-log. (Uwe Schindler)
 - Fixed bug #29116 (Zend constant warning uses memory after free). (Marcus,
   jdolecek at NetBSD dot org)
+- Fixed Bug #29075 (strnatcmp() incorrectly handles whitespace). (Curt, Ilia)
 - Fixed bug #29049 (array sorting via user function/method does not validate 
   it). (Ilia)
 - Fixed bug #29038 (extract() with EXTR_PREFIX_SAME prefixes empty strings).
@@ -14,7 +15,6 @@
   (Ilia)
 - Fixed bug #28974 (overflow in array_slice(), array_splice(), substr,
   substr_replace(), strspn(), strcspn()). (Andrey)
-- Fixed bug #28963 (Missing space for \0 in address allocation). (Ilia)
 - Fixed bug #28897 (ibase: -1 returned as -0.000 for 64-bit scaled int). (Ard)
 - Fixed bug #28879 (Implicit/Explicit array creation inconsistency when using
   Resources, Arrays, or Objects as indices). (Sara)

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

Reply via email to