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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Hosting Requirements /

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

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

forced and random mbstring.func_overload


Go to End


23 Posts   15851 Views

Avatar
UncleCheese

Forum Moderator, 4102 Posts

16 April 2009 at 5:07am

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

Avatar
rndmerle

Community Member, 24 Posts

16 April 2009 at 5:18am

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.

Avatar
UncleCheese

Forum Moderator, 4102 Posts

16 April 2009 at 5:55am

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..

Avatar
rndmerle

Community Member, 24 Posts

16 April 2009 at 6:50am

Edited: 16/04/2009 6:51am

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.

Avatar
rndmerle

Community Member, 24 Posts

21 April 2009 at 3:16am

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.

Avatar
rndmerle

Community Member, 24 Posts

22 April 2009 at 1:27am

Edited: 22/04/2009 1:29am

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/renaudmerle.fr/httpdocs/sapphire/core/SSViewer.php

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..

Regards.

Avatar
UncleCheese

Forum Moderator, 4102 Posts

22 April 2009 at 11:07am

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.

Avatar
rndmerle

Community Member, 24 Posts

22 April 2009 at 11:13am

Edited: 22/04/2009 7:08pm

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

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

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

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.