[drupal-devel] [bug] Clash with mbstring extension

Steven drupal-devel at drupal.org
Mon Mar 28 16:59:32 UTC 2005


Issue status update for http://drupal.org/node/11758

 Project:      Drupal
 Version:      4.5.0
 Component:    menu system
 Category:     bug reports
 Priority:     minor
 Assigned to:  Anonymous
 Reported by:  Anonymous
 Updated by:   Steven
 Status:       active

This won't be fixed unless there is a clear description of the problem
and its solution, which complies with the Drupal coding standards.


Steven



Previous comments:
------------------------------------------------------------------------

October 20, 2004 - 08:05 : Anonymous

I guess this is very minor stuff, but anyway...
If the mbstring extension is loaded, the call to strrpos() in
[...]/includes/menu.inc on line 910 will give a /warning: mb_strrpos():
Empty haystack in [...]\includes\menu.inc on line 910/. This will output
sometimes (e.g. when saving the theme selection in the admin area)
before headers are sent producing thus additional errors. On other
occurrences it will simply appear at the top of the page.
The problem is easily solved by not using the mbstring extension in
PHP, which anyway is not set by default.
Tried on Windows XP + Apache 2.0.49 + PHP 4.3.2 + Drupal 4.5.0


------------------------------------------------------------------------

October 20, 2004 - 18:52 : vitamin

That's because mbstring doesn't like empty arguments.
The fix is described here (in russian), thanks to Basielienis:
http://drupal.ru/node/view/310
Shortly, you should search in menu.inc (line 910 in 4.5.0) and replace
line
$parent = substr($parent, 0, strrpos($parent, '/'));
with
if ($parent) $_lenght = strrpos($parent, "/");
$parent = substr($parent, 0, $_lenght);
ps: Can anybody commit this in HEAD?


------------------------------------------------------------------------

October 20, 2004 - 20:56 : Uwe Hermann

This looks a bit strange to me (I haven't tested it though). Isn't
$_length uninitialized if $parent is non-empty?Is that desired? If yes,
though it may work, it's not a very obvious or clean solution, IMHO.


------------------------------------------------------------------------

October 29, 2004 - 08:38 : Anonymous

I had this same issue.  The solution for me was to revert back to
default values on a setting I had changed in my /etc/php.ini.  My
php.ini included
*mbstring.func_overload = 7*
after resetting it back to the default value
*mbstring.func_overload = 0*
drupal as once again happy.
I had set that value to 7 at the suggestion of eGroupWare, to allow
support for utf extended characters (if I understood it correctly).
Hope that helps--
rob at shrouded.net


------------------------------------------------------------------------

October 31, 2004 - 18:22 : vitamin

Yes, but disabling function overload you disable using unicode aware
string functions in php.
As a result, you loose case insensetive searching in languages other
than English.
AFAIR, drupal doesn't use mbstring extension directly, so the only way
for non-english speaking people to use full functional searching is to
enable function overloading, so strrpos() is automagically replaced
with mb_strrpos(), ereg() with mb_ereg() etc.
I hope that one day somebody of developers will fix this annoying bug..





More information about the drupal-devel mailing list