Jump to:

23369 Posts in 18145 Topics by 2863 members

General Questions

SilverStripe Forums » General Questions » SS3.0.3 / CMS: reload content

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Page: 1
Go to End
Author Topic: 328 Views
  • dacar
    Avatar
    Community Member
    168 Posts

    SS3.0.3 / CMS: reload content Link to this post

    Hi,

    i am just testing SS3.0.3 and found an issue. If i switch between two menu items in the sitetree, tahn the content will not reload. you have to reload the whole window to show the new content. During the installation process i had to delete mb_regex_encoding('UTF-8'); in Core.php because of some error messages. Is that related to the problem? How to aktivate mb_regex_encoding in php.ini? My PHP version is 5.3.0

    Hope that someone can help. Greetings, Carsten.

    ERROR [Warning]: json_encode() [<a href='function.json-encode'>function.json-encode</a>]: Invalid UTF-8 sequence in argument
    IN GET /silver_test/admin/pages/edit/show/2
    Line 103 in /framework/core/Convert.php

    Source
    ======
    94:    }
    95:
    96:    /**
    97:     * Encode a value as a JSON encoded string.
    98:     *
    99:     * @param mixed $val Value to be encoded
    100:     * @return string JSON encoded string
    101:     */
    102:    public static function raw2json($val) {
    * 103:       return json_encode($val);
    104:    }
    105:
    106:    /**
    107:     * Encode an array as a JSON encoded string.
    108:     * THis is an alias to {@link raw2json()}
    109:     *

    Trace
    =====
    json_encode(Array)
    Convert.php:103

    Convert::raw2json(Array)
    PjaxResponseNegotiator.php:87

    PjaxResponseNegotiator->respond(SS_HTTPRequest)
    LeftAndMain.php:464

    LeftAndMain->show(SS_HTTPRequest)
    Controller.php:205

    Controller->handleAction(SS_HTTPRequest)
    RequestHandler.php:184

    RequestHandler->handleRequest(SS_HTTPRequest,DataModel)
    Controller.php:153

    Controller->handleRequest(SS_HTTPRequest,DataModel)
    LeftAndMain.php:357

    LeftAndMain->handleRequest(SS_HTTPRequest,DataModel)
    AdminRootController.php:89

    AdminRootController->handleRequest(SS_HTTPRequest,DataModel)
    Director.php:307

    Director::handleRequest(SS_HTTPRequest,Session,DataModel)
    Director.php:119

    Director::direct(/admin/pages/edit/show/2,DataModel)
    main.php:126

    {"Content":null}

  • dacar
    Avatar
    Community Member
    168 Posts

    Re: SS3.0.3 / CMS: reload content Link to this post

    Hi, i think i have found the solution: I have Changed "framework/core/convert.php" from

       public static function raw2json($val) {
          return json_encode($val);
       }

    to

       public static function raw2json($val) {
          array_walk_recursive($val, function (&$item, $key) {
             if (is_string($item)) $item = mb_encode_numericentity($item, array (0x80, 0xffff, 0, 0xffff), 'UTF-8');
          });
          return mb_decode_numericentity(json_encode($val), array (0x80, 0xffff, 0, 0xffff), 'UTF-8');
          
          //return json_encode($val);
       }

    Now it seems to work. I think with this solution u can use SS3 without mb_regex_encoding('UTF-8');

    Greetings, Carsten.

    328 Views
Page: 1
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.