From: josmessa at uk dot ibm dot com Operating system: Windows XP SP2 PHP version: 5.2CVS-2008-01-31 (snap) PHP Bug Type: mbstring related Bug description: mb_substr_count behaves differently to substr_count with overlapping needles
Description: ------------ In the documentation for substr_count there is a note that says: "Note: This function doesn't count overlapped substrings. See the example below! ". mb_substr_count does not replicate this behaviour, and as mb_substr_count can overload substr_count I think it should. Reproduce code: --------------- <?php $string_ascii = 'abcabcabc'; echo "mb_substr_count: "; var_dump(mb_substr_count($string_ascii, 'abcabc')); //needle overlaps in haystack echo "substr_count: "; var_dump(substr_count($string_ascii, 'abcabc')); ?> Expected result: ---------------- mb_substr_count: int(1) substr_count: int(1) Actual result: -------------- mb_substr_count: int(2) substr_count: int(1) -- Edit bug report at http://bugs.php.net/?id=43993&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=43993&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=43993&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=43993&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=43993&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=43993&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=43993&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=43993&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=43993&r=needscript Try newer version: http://bugs.php.net/fix.php?id=43993&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=43993&r=support Expected behavior: http://bugs.php.net/fix.php?id=43993&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=43993&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=43993&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=43993&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=43993&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=43993&r=dst IIS Stability: http://bugs.php.net/fix.php?id=43993&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=43993&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=43993&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=43993&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=43993&r=mysqlcfg