moriyoshi Fri Aug 1 22:56:47 2008 UTC
Added files: (Branch: PHP_5_3)
/php-src/ext/mbstring/tests bug43993.phpt
Modified files:
/php-src/ext/mbstring/libmbfl/mbfl mbfilter.c
Log:
- MFH: Fixed bug #43993 (mb_substr_count() behaves differently to
substr_count() with overlapping needles)
http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/libmbfl/mbfl/mbfilter.c?r1=1.7.2.5.2.1&r2=1.7.2.5.2.1.2.1&diff_format=u
Index: php-src/ext/mbstring/libmbfl/mbfl/mbfilter.c
diff -u php-src/ext/mbstring/libmbfl/mbfl/mbfilter.c:1.7.2.5.2.1
php-src/ext/mbstring/libmbfl/mbfl/mbfilter.c:1.7.2.5.2.1.2.1
--- php-src/ext/mbstring/libmbfl/mbfl/mbfilter.c:1.7.2.5.2.1 Sun Aug 19
01:58:39 2007
+++ php-src/ext/mbstring/libmbfl/mbfl/mbfilter.c Fri Aug 1 22:56:47 2008
@@ -1013,6 +1013,7 @@
if (pc.matched_pos >= 0) {
++result;
pc.matched_pos = -1;
+ pc.needle_pos = 0;
}
n--;
}
http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/tests/bug43993.phpt?view=markup&rev=1.1
Index: php-src/ext/mbstring/tests/bug43993.phpt
+++ php-src/ext/mbstring/tests/bug43993.phpt
--TEST--
Bug #43993 (mb_substr_count() behaves differently to substr_count() with
overlapping needles)
--SKIPIF--
<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?>
--FILE--
<?php
var_dump(mb_substr_count("abcabcabca", "abcabc"));
var_dump(mb_substr_count("abcabcabca", "abc"));
var_dump(mb_substr_count("abcabcabca", "cab"));
var_dump(mb_substr_count("abcabcabca", "bca"));
var_dump(mb_substr_count("ababababab", "ba"));
var_dump(mb_substr_count("ababababab", "ab"));
var_dump(mb_substr_count("ababababab", "bc"));
var_dump(mb_substr_count("aaaaaaaaaa", "a"));
var_dump(mb_substr_count("aaaaaaaaaa", "b"));
?>
--EXPECT--
int(1)
int(3)
int(2)
int(3)
int(4)
int(5)
int(0)
int(10)
int(0)
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php