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
rndmerle

Community Member, 24 Posts

22 April 2009 at 11:21am

The value of mbstring.func_overload is an integer that tells Mbstring which functions it has to override.
For us, randomly, the php engine is behaving like if mbstring.func_overload was equal to 4.
Here is a table of the possible values : http://www.php-editors.com/php_manual/ref.mbstring.html#mbstring.overload

The overload of classic str functions by mb_str functions should not be a problem. But actually it's a problem because :
1/ mb_substr_count and substr_count don't have the same signatures/arguments. I don't know the hell why.
2/ it seems that ereg_replace doesn't complain about a mismatching parenthesis in a regex pattern. But mb_ereg_replace complains.

Avatar
Solo

Community Member, 32 Posts

11 February 2010 at 3:11pm

It is the hoster problem, not ss. To solve it, edit .htaccess file and set: php_value mbstring.func_overload 1.

Avatar
JordanC

Community Member, 9 Posts

16 March 2010 at 3:35pm

If you are unable to override the mbstring.func_overload in .htaccess

The suggestion above worked for me:

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

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

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

Avatar
Solo

Community Member, 32 Posts

25 March 2010 at 7:23pm

Setting php_value mbstring.func_overload 1 is not good for your server letters (the coding becomes wrong).
The best, is to set .htaccess:

php_value output_buffering On
php_value output_handler mb_output_handler
php_value default_charset UTF-8
php_value mbstring.language Russian(set yours)
php_value mbstring.http_input auto
php_value mbstring.http_output UTF-8
php_value mbstring.internal_encoding UTF-8
php_value mbstring.substitute_character none
php_value mbstring.func_overload 6

I having same problem when i used ModX.

Avatar
Anatol

126 Posts

6 August 2010 at 4:15pm

Edited: 06/08/2010 4:16pm

Thank you! This post probably saved me a few frustrating hours. I had the same problem and Silverstripe would just show an error message after the installation. I installed Silverstripe 2.4.1 (around August 2010) and the problem still doesn't seem to be fixed - or maybe it only appears in certain server environments. I added the following two backslashes in green in /sapphire/core/SSViewer.php , line 581 and 582 in my version of Silverstripe:

		// i18n sprintf(_t(...),$argument) with entity only (no dots in namespace), meaning the current template filename will be added as a namespace
		$content = ereg_replace('<' . '% +sprintf\(_t\((\'([^\.\']*)\'|"([^\."]*)")(([^)]|\)[^ ]|\) +[^% ])*)\),\<\?= +([^\?]*) +\?\>\) +%' . '>', '<?= sprintf(_t(\''. $path[1] . '.\\2\\3\'\\4),\\6) ?>', $content);
		// i18n sprintf(_t(...),$argument)
		$content = ereg_replace('<' . '% +sprintf\(_t\((\'([^\']*)\'|"([^"]*)")(([^)]|\)[^ ]|\) +[^% ])*)\),\<\?= +([^\?]*) +\?\>\) +%' . '>', '<?= sprintf(_t(\'\\2\\3\'\\4),\\6) ?>', $content);

Cheers!
Anatol

Avatar
bennettpr

Community Member, 37 Posts

18 August 2011 at 8:25pm

Thanks for posting this Anatol.

I can confirm it's still an issue on some hosts when using version 2.4.5

I tried to copy a site which was previously installed on another server and had this error but patching the SSViewer.php file didn't work on a site which had been installed previously.
The only solution I've found is to delete the files, empty the db, load up a fresh version of SilverStripe 2.4.5, patch the file and install as normal.

Just in case this helps anyone else.

Paul

Avatar
Darkfaythe

Community Member, 6 Posts

17 April 2012 at 4:50pm

Thanks for this post Anatol, this is still an issue with 2.4.7 as well and this change in the SS_Viewer.php file sorted it nicely.

Cheers

Go to Top