Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Hosting Requirements

What you need to consider when choosing a hosting provider and plan.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

forced and random mbstring.func_overload


23 Posts   9492 Views


16 April 2009 at 5:07am 4085 Posts

Interesting. The in the live environment I just get a blank screen instead of a warning message. Man, what a headache.


16 April 2009 at 5:18am Community Member, 24 Posts

You mean that you get a blank page when the warning triggers and you get it by email ? And the rest of the time the page displays correctly ?
It's weird because my pages always display correctly, even when a warning triggers.


16 April 2009 at 5:55am 4085 Posts

I've never gotten my page to display. It throws the warning in dev mode and a blank page in live mode. Checked the error logs and everything. There are no fatal errors. Agh..


16 April 2009 at 6:50am (Last edited: 16 April 2009 6:51am), Community Member, 24 Posts

To avoid this problem, you could try to replace :

$shiftCount = substr_count($pattern, '/', 0, $doubleSlashPoint) + 1;

By :

$shiftCount = substr_count( array_shift( split('(//)', $pattern ) ), '/' ) + 1;

On line 303 in sapphire/core/control/HTTPRequest.php

Because my site still works properly, I'm looking for a better solution to this issue.


21 April 2009 at 3:16am Community Member, 24 Posts

Well. My host's technical service has been actively looking for a solution but with no success :/
So, for now, I'm using the HTTPRequest.php code modification to avoid the issue.


22 April 2009 at 1:27am (Last edited: 22 April 2009 1:29am), Community Member, 24 Posts

This fix is partial :/
I forgot the mb_ereg_replace problem.
For some reason it didn't cause me any "visual" trouble before, but now I get the white page, like you UncleCheese.
The error is :

[Warning] mb_ereg_replace() [function.mb-ereg-replace]: mbregex compile err: unmatched close parenthesis
Line 494 in /var/www/vhosts/

I don't see how to fix that, for now.

This issue is really weird. One out of ten requests, on average, the server act as if it was configured with
mbstring.func_overload = 7
And thus, replacing regular str functions with mb_str function, which are not really compatible.

I'm currently asking my host to completely deactivate Mbstring.
We'll see..



22 April 2009 at 11:07am 4085 Posts

Great. Thanks for the updates. What exactly does the value of mbstring_func_overload mean, anyway? It might explain why my site is so intermittent with the problem, as well.


22 April 2009 at 11:13am (Last edited: 22 April 2009 7:08pm), Community Member, 24 Posts

It happens there is one error in the pattern of two regex in sapphire/core/SSViewer.php.
Ereg_replace doesn't complain about it, but mb_ereg_replace (and preg_replace too) does. At lines 494 and 496, the last closed parenthesis of the pattern needs to be escaped

,\<\?= +([^\?]*) +\?\>) +%' . '>',


,\<\?= +([^\?]*) +\?\>\) +%' . '>',

I join a diff file.

It seems I solved the 2 visible symptoms, but I still have no clue why mbstring randomly overload str functions :/

I'm going to post two bugs report about this ereg error and about the substr_count modification in order to make it compatible with mb_substr_count.

Attached Files