Edit report at https://bugs.php.net/bug.php?id=49790&edit=1
ID: 49790
Comment by: andre at koethur dot de
Reported by:pg dot millon at gmail dot com
Summary:mb_substr_count and substr_count do not have the
same definition
Status: Open
Type: Feature/Change Request
Package:mbstring related
Operating System: Ubuntu
PHP Version:5.2.11
Block user comment: N
Private report: N
New Comment:
Without the offset parameter, this function is quite useless, because it will
behave exact like a binary safe substr_count() with $offset=0. In other words;
There is only a need for a multi byte aware substr_count when $offset > 0 â¦
Previous Comments:
[2013-03-19 13:07:47] neggelandia at gmail dot com
The problem goes deeper. substr_count() takes 4 parameters while
mb_substr_count() only takes three (and the third doens't even have the same
meaning), which produces errors such as this:
mb_substr_count() expects at most 3 parameters, 4 given
This makes the mbstring.func_overload configuration parameter misbehave.
[2009-10-06 15:52:02] pg dot millon at gmail dot com
Description:
I'm using the mbstring_funcoverload property defined to 7 which allows the
overload of every functions. While using the function substr_count with the 3
parameter (offset) defined. As overloading is activated, calling substr_count
is equivalent to calling mb_substr_count but the offset parameter does not
exists for this function
Reproduce code:
---
In php.ini: mbstring.func_overload 7
$var = substr_count('/some/path', DIRECTORY_SEPARATOR, 0);
Expected result:
1
Actual result:
--
Warning: mb_substr_count(): Unknown encoding "0" in php shell code on line 1
Call Stack:
6.0376 46516 1. {main}() php shell code:0
6.0376 46648 2. mb_substr_count() php shell code:1
--
Edit this bug report at https://bugs.php.net/bug.php?id=49790&edit=1