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.
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
6 August 2010 at 4:15pm
(Last edited: 6 August 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 . '.\\2\\3\'\\4),\\6) ?>', $content);
// i18n sprintf(_t(...),$argument) $content = ereg_replace('<' . '% +sprintf\(_t\((\'([^\']*)\'|"([^"]*)")(([^)]|\)[^ ]|\) +[^% ])*)\),\<\?= +([^\?]*) +\?\>\) +%' . '>', '<?= sprintf(_t(\'\\2\\3\'\\4),\\6) ?>', $content);
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.