Jump to:

556 Posts in 3276 Topics by 243 members

Hosting Requirements

SilverStripe Forums » Hosting Requirements » forced and random mbstring.func_overload

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

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

Page: 1 2 3
Go to End
Author Topic: 9209 Views
  • rndmerle
    Avatar
    Community Member
    24 Posts

    Re: forced and random mbstring.func_overload Link to this post

    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.

  • Solo
    Avatar
    Community Member
    32 Posts

    Re: forced and random mbstring.func_overload Link to this post

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

  • JordanC
    Avatar
    Community Member
    9 Posts

    Re: forced and random mbstring.func_overload Link to this post

    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

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

  • Solo
    Avatar
    Community Member
    32 Posts

    Re: forced and random mbstring.func_overload Link to this post

    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.

  • Anatol
    Avatar
    126 Posts

    Re: forced and random mbstring.func_overload Link to this post

    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

  • bennettpr
    Avatar
    Community Member
    37 Posts

    Re: forced and random mbstring.func_overload Link to this post

    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

  • Darkfaythe
    Avatar
    Community Member
    6 Posts

    Re: forced and random mbstring.func_overload Link to this post

    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

    9209 Views
Page: 1 2 3
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.