This is the difference between PHP 5.3 (and probably also in earlier versions) and PHP 5.4.
Actually, you can see the problem in the PHP source code if you're interested.
This is the ext/mbstring/mbstring.c file, which has the following difference in the PHP_FUNCTION(mb_substr) function.
In PHP 5.3, they check this condition:
if (argc < 3) { len = str_len; }
While in PHP 5.4 they use:
if (argc < 3 || Z_TYPE_PP(z_len) == IS_NULL) { len = str_len; }
These definitions can be found in the implementation of the mb_string function, which is launched by PHP_FUNCTION(mb_substr) in the specified file. Source code can be downloaded from the php.net download page .
source share