tony2001                Wed Oct  4 11:14:32 2006 UTC

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

  Modified files:              
    /php-src    NEWS 
    /php-src/ext/standard       string.c 
  Log:
  MFH: fix #39032 (strcspn() stops on null character)
  
  
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.280&r2=1.2027.2.547.2.281&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.280 php-src/NEWS:1.2027.2.547.2.281
--- php-src/NEWS:1.2027.2.547.2.280     Tue Oct  3 11:10:32 2006
+++ php-src/NEWS        Wed Oct  4 11:14:32 2006
@@ -7,6 +7,7 @@
 - Fixed mess with CGI/CLI -d option (now it works with cgi; constants are
   working exactly like in php.ini; with FastCGI -d affects all requests).
   (Dmitry)
+- Fixed bug #39032 (strcspn() stops on null character). (Tony)
 - Fixed bug #39017 (foreach(($obj = new myClass) as $v); echo $obj; segfaults).
   (Dmitry)
 - Fixed bug #39004 (Fixed generation of config.nice with autoconf 2.60).
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.445.2.14.2.23&r2=1.445.2.14.2.24&diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.445.2.14.2.23 
php-src/ext/standard/string.c:1.445.2.14.2.24
--- php-src/ext/standard/string.c:1.445.2.14.2.23       Tue Oct  3 17:41:47 2006
+++ php-src/ext/standard/string.c       Wed Oct  4 11:14:32 2006
@@ -18,7 +18,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: string.c,v 1.445.2.14.2.23 2006/10/03 17:41:47 iliaa Exp $ */
+/* $Id: string.c,v 1.445.2.14.2.24 2006/10/04 11:14:32 tony2001 Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -1500,7 +1500,7 @@
                        if (*spanp == c || p == s1_end) {
                                return p - s1;
                        }
-               } while (spanp++ < s2_end);
+               } while (spanp++ < (s2_end - 1));
                c = *++p;
        }
        /* NOTREACHED */

http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/bug39032.phpt?view=markup&rev=1.1
Index: php-src/ext/standard/tests/strings/bug39032.phpt
+++ php-src/ext/standard/tests/strings/bug39032.phpt
--TEST--
Bug #39032 (strcspn() stops on null character)
--FILE--
<?php

var_dump(strcspn(chr(0),"x"));
var_dump(strcspn(chr(0),""));
var_dump(strcspn(chr(0),"qweqwe"));
var_dump(strcspn(chr(1),"qweqwe"));

echo "Done\n";
?>
--EXPECTF--     
int(1)
int(0)
int(1)
int(1)
Done

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to