|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #34155 Multibyte string functions trigger warnings unlike native functions
Submitted: 2005-08-16 20:56 UTC Modified: 2007-06-18 16:33 UTC
Avg. Score:4.5 ± 0.5
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:1 (50.0%)
From: scott at vbulletin dot com Assigned:
Status: Closed Package: mbstring related
PHP Version: 5CVS-2005-08-16 (CVS) OS: *
Private report: No CVE-ID: None
 [2005-08-16 20:56 UTC] scott at vbulletin dot com
If you use mbstring.func_overload in php.ini various string functions will be overloaded with their mb_* equivalents.

The mb functions will trigger warnings when certain parameters are empty or null unlike their native counterparts.

Reproduce code:

var_dump(strrpos('', '/'));
var_dump(mb_strrpos('', '/'));


Expected result:

Actual result:
Warning: mb_strrpos(): Empty haystack in /home/vbulletin/public_html/dev/test.php on line 4


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2005-08-17 13:23 UTC] scott at vbulletin dot com
I'm reporting inconsitent behaviour, either add the same error message to strrpos or remove it from mb_strrpos.

Probably add it to strrpos and strripos since the majority fo the native string functions throw warnings on invalid parameters.
 [2005-08-18 12:57 UTC]
Please provide a list of functions that differ from native functions.

 [2005-08-26 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2007-06-14 08:20 UTC] nil at hippy dot csoma dot elte dot hu

It would be better not to give E_WARNING. If you search something in an empty string then you will not find it. There is no special things around here that needs to be "warning-ed". I had to write "if"s around many strrpos() and strpos() calls when switched my site to UTF-8.

Regards, Nil.
 [2007-06-18 16:33 UTC]
Appears this was fixed in
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 01 22:01:28 2024 UTC