php.net |  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
Votes:2
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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: scott at vbulletin dot com
New email:
PHP Version: OS:

 

 [2005-08-16 20:56 UTC] scott at vbulletin dot com
Description:
------------
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:
---------------
<?php

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

?>

Expected result:
----------------
bool(false)
bool(false)

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

Patches

Pull Requests

History

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] sniper@php.net
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
Hi!

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] scottmac@php.net
Appears this was fixed in http://bugs.php.net/bug.php?id=39361
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 26 15:01:32 2024 UTC