need help in updating function to modern php code preg replace

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    need help in updating function to modern php code preg replace

    can someone please fix this error in function from gumslone gumchat v3 script

    function is

    PHP Code:
    function mb_unserialize($serial_str) {
        
    $out preg_replace('!s:(\d+):"(.*?)";!se'"'s:'.strlen('$2').':"$2";'"$serial_str);
        return 
    unserialize($out);

    and error is

    PHP Code:
    PHP Warning:  preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead 
    it is used for user database settings where smileys and color is inserted in serialized kinda way then unserialized using this function above to use in script for
    turning smileys on off and selecting username colors aswell as ignore list
    ComputerForumz - Latest Tech News


    Mobbest.tk-Free Mobile Downloads

    #2
    Your above code is incorrect due to coding-talks [ php] bbcode - try using [ code] bbcode instead.

    Comment


      #3
      Code:
      function mb_unserialize($serial_str) {
          $out = preg_replace('!s:(\d+):"(.*?)";!se', "'s:'.strlen('$2').':\"$2\";'", $serial_str);
          return unserialize($out);
      }
      ComputerForumz - Latest Tech News


      Mobbest.tk-Free Mobile Downloads

      Comment


        #4

        Code:
        function mb_unserialize($serial_str) {
            $out = preg_replace_callback('!s:(\d+):"(.*?)";!s', 
            function($m) 
            {
                    return 's:' . strlen($m[2]) . ':\"' . $m[2] . '\";';
            },
            $serial_str);
            return unserialize($out);
        }

        Comment


          #5
          thanks something else
          ComputerForumz - Latest Tech News


          Mobbest.tk-Free Mobile Downloads

          Comment

          Working...
          X