iliaa           Sat Jul 23 15:44:14 2005 EDT

  Modified files:              
    /php-src/ext/standard/tests/strings str_word_count.phpt 
    /php-src/ext/standard       string.c 
  Log:
  Fixed bug in str_word_count() when charlist if specified and "word" starts
  with a character found inside the charlist.
  
  
http://cvs.php.net/diff.php/php-src/ext/standard/tests/strings/str_word_count.phpt?r1=1.3&r2=1.4&ty=u
Index: php-src/ext/standard/tests/strings/str_word_count.phpt
diff -u php-src/ext/standard/tests/strings/str_word_count.phpt:1.3 
php-src/ext/standard/tests/strings/str_word_count.phpt:1.4
--- php-src/ext/standard/tests/strings/str_word_count.phpt:1.3  Sat Mar 12 
12:51:18 2005
+++ php-src/ext/standard/tests/strings/str_word_count.phpt      Sat Jul 23 
15:44:12 2005
@@ -118,7 +118,7 @@
   [2]=>
   string(1) "r"
   [3]=>
-  string(1) "s"
+  string(2) "1s"
   [4]=>
   string(3) "bar"
   [5]=>
@@ -130,7 +130,7 @@
   [1]=>
   string(3) "B4r"
   [2]=>
-  string(1) "s"
+  string(2) "1s"
   [3]=>
   string(3) "bar"
   [4]=>
@@ -181,8 +181,8 @@
   string(1) "B"
   [6]=>
   string(1) "r"
-  [9]=>
-  string(1) "s"
+  [8]=>
+  string(2) "1s"
   [11]=>
   string(3) "bar"
   [15]=>
@@ -193,8 +193,8 @@
   string(3) "F0o"
   [4]=>
   string(3) "B4r"
-  [9]=>
-  string(1) "s"
+  [8]=>
+  string(2) "1s"
   [11]=>
   string(3) "bar"
   [15]=>
http://cvs.php.net/diff.php/php-src/ext/standard/string.c?r1=1.443&r2=1.444&ty=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.443 php-src/ext/standard/string.c:1.444
--- php-src/ext/standard/string.c:1.443 Fri Jul 15 08:35:12 2005
+++ php-src/ext/standard/string.c       Sat Jul 23 15:44:13 2005
@@ -18,7 +18,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: string.c,v 1.443 2005/07/15 12:35:12 hyanantha Exp $ */
+/* $Id: string.c,v 1.444 2005/07/23 19:44:13 iliaa Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -4739,8 +4739,8 @@
        }
        
        while (p < e) {
-               if (isalpha(*p++)) {
-                       s = p - 1;
+               if (isalpha(*p) || (char_list && ch[(unsigned char)*p])) {
+                       s = ++p - 1;
                        while (isalpha(*p) || *p == '\'' || (*p == '-' && 
isalpha(*(p+1))) || (char_list && ch[(unsigned char)*p])) {
                                p++;
                        }
@@ -4761,7 +4761,9 @@
                                        word_count++;
                                        break;          
                        }
-               }       
+               } else {
+                       p++;
+               }
        }
        
        if (!type) {

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

Reply via email to