Decodes session data
@param  string $str Data
@return boolean
170616
protected function sessionDecode($str)
    {
        $type = ini_get('session.serialize_handler');
        if ($type === 'php') {
            $this->setSessionState($this->unserializePHP($str));
            return true;
        }
        if ($type === 'php_binary') {
            $this->setSessionState(igbinary_unserialize($str));
            return true;
        }
        return false;
    }
1218463
public function unescapeMd($str)
    {
        if (strpos ($str,'\\') === false) return $str;
        return preg_replace(self::UNESCAPE_MD_RE, '$1', $str);
    }
299312
public static function decode(string $str, \Exception &$err = null): TagContext
    {
        $tagContext = TagContext::empty();
        $strLen = strlen($str);
        if ($strLen == 0) {
            return $tagContext;
        }
        if ($str[0] > self::TAGS_VERSION_ID) {
            $err = new \Exception("cannot decode: unsupported version: " . ord($str[0]) .
                "; supports only up to: " . ord(self::TAGS_VERSION_ID));
            return $tagContext;
        };

        $idx = 1;

        $tagsLen = 0;
        while ($idx < $strLen) {
            // read keytype
            if ($str[$idx] != self::KEYTYPE_STRING) {
                $err = new \Exception("cannot decode: invalid key type: " . ord($str[$idx]));
                return TagContext::empty();
            }
            $idx++;

            if ($idx >= $strLen) {
                $err = new \Exception("unexpected end: index: " . $idx . " length: " . $strLen);
            }

            // read varint (key length)
            $keyLen = 0;
            $cnt = self::decodeUnsigned(substr($str, $idx), $keyLen);
            if ($cnt <= 0 || $keyLen == 0) {
                $err = new \Exception("cannot decode: key length varint");
                return TagContext::empty();
            }
            $idx += $cnt;

            // read key payload of size $keylen
            $valueEnd = $idx + $keyLen;
            if ($valueEnd > $strLen) {
                $err = new \Exception("malformed encoding: length: $keyLen, upper: $valueEnd, maxLength: $strLen");
                return TagContext::empty();
            }
            try {
                $key = TagKey::create(substr($str, $idx, $keyLen));
            } catch (\Exception $e) {
                $err = $e;
                return TagContext::empty();
            }
            $idx = $valueEnd;

            // read varint (value length)
            $valLen = 0;
            $cnt = self::decodeUnsigned(substr($str, $idx), $valLen);
            if ($cnt <= 0 || $keyLen == 0) {
                $err = new \Exception("cannot decode: value length varint");
                return TagContext::empty();
            }

            // Total size of all Tag key + value strings excluding serialization
            // details should not be greater than TagContext::MAX_LENGTH
            // Since TagContext extraction is an all or nothing operation, we
            // fail the decode step if overstepping TagContext::MAX_LENGTH.
            $tagsLen += $keyLen + $valLen;
            if ($tagsLen > TagContext::MAX_LENGTH) {
                $err = new \Exception(TagContext::EX_INVALID_CONTEXT);
                return TagContext::empty();
            }

            $idx += $cnt;

            // read value payload of size $valLen
            $valueEnd = $idx + $valLen;
            if ($valueEnd > $strLen) {
                $err = new \Exception("malformed encoding: length: $valLen, upper: $valueEnd, maxLength: $strLen");
                return TagContext::empty();
            }
            try {
                $value = TagValue::create(substr($str, $idx, $valLen));
            } catch (\Exception $e) {
                $err = $e;
                return TagContext::empty();
            }
            $idx = $valueEnd;

            $tagContext->upsert($key, $value);
        }


        return $tagContext;
    }
780925
public function encrypt($str = '')
    {
        $block = mcrypt_get_block_size('rijndael_128', 'ecb');
        $pad   = $block - (strlen($str) % $block);
        $str   .= str_repeat(chr($pad), $pad);

        return base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $this->config[self::CSP_CONFIG]['keyEncrypt'], $str, MCRYPT_MODE_ECB));
    }
151332
public function decode($str)
    {
        $fixlen    = strlen($this->fixed_code);
        $user_id   = substr($str, -$this->length);
        $salt_rand = (int)substr($str, $fixlen, 1);
        $rand      = substr($str, $fixlen + 1, 4);

        $len  = strlen($user_id);
        $rlen = strlen($rand);
        $slen = count($this->salt);

        //对随机码解密
        $sr = $salt_rand;
        for ($j = 0; $j < $rlen; $j++) {
            if ($rand[$j] >= $sr) {
                $rand[$j] = $rand[$j] - $sr;
            } else {
                $rand[$j] = 10 - abs($rand[$j] - $sr);
            }

            $sr = ($rand[$j] + $sr) % 10;
        }

        //对用户ID加密
        for ($i = 0; $i < $len; $i++) {
            $k1 = $i % $rlen;
            $k2 = $i % $slen;

            $rval1 = $rand[$k1];

            if ($user_id[$i] >= $this->salt[$k2][$rval1]) {
                $user_id[$i] = $user_id[$i] - $this->salt[$k2][$rval1];
            } else {
                $user_id[$i] = 10 - abs($user_id[$i] - $this->salt[$k2][$rval1]);
            }
        }

        if ($this->validateNumber($user_id . $salt_rand)) {
            return ltrim($user_id, '0');
        } else {
            return 0;
        }
    }
1292539
public static String decode(String str) {
    if (str != null) {
      try {
        return URLDecoder.decode(str, UTF_8.name());
      } catch (UnsupportedEncodingException e) {
        throw new RuntimeException("JVM must support UTF-8", e);
      }
    }
    return null;
  }
1230139
public static <T> T deserialize(String str) {
        if (StringUtils.isEmpty(str)) {
            return null;
        }
        ByteArrayInputStream bis = null;
        ObjectInputStream ois = null;
        try {
            Base64.Decoder decoder = Base64.getDecoder();
            bis = new ByteArrayInputStream(
                    decoder.decode(str));
            ois = new ObjectInputStream(bis);
            return (T) ois.readObject();
        } catch (Exception e) {
            throw new RuntimeException("deserialize session error", e);
        } finally {
            CommonUtils.closeIOStream(bis, null);
            CommonUtils.closeIOStream(ois, null);
        }
    }
1366252
private function evalString($str)
    {
        $a = false;

        if (class_exists('ParseError')) {
            try {
                $a = eval("return $str;");
            } catch (ParseError $e) {
            }
        } else {
            $a = @eval("return $str;");
        }

        return $a;
    }
1365096
public function decrypt(string $str): string
    {
        return openssl_decrypt($str, self::CIPHER_METHOD, $this->key, 0, $this->getIv());
    }
325115
public static function decryptG($str, $secret = 'ePHP')
    {
        if (!$str) {
            return false;
        }

        $key = md5($secret . "30f7384ac1");

        $ciphertext_raw = \ePHP\Misc\Func::safe_b64decode($str);
        return openssl_decrypt($ciphertext_raw, 'AES-128-ECB', $key, OPENSSL_RAW_DATA);
    }
67019
public static function decode($string)
    {
        return ($string === self::NULL) ? null : strtr($string, self::$decodeMap);
    }
332267
private function unescapeLatinCharacters($str)
    {
        if ($this->latinCharacters) {
            $str = vsprintf($str, $this->latinCharacters);
            $this->latinCharacters = array();
        }

        return $str;
    }
1264512
public static function parseAttribString($str, $decode = true, $decodeData = true)
    {
        return \bdk\Debug\Utilities::parseAttribString($str, $decode, $decodeData);
    }
85553
public static function decode($str, &$index)
    {
        $result = 0;
        $shift = 0;

        do {
            $c = $str[$index++];
            $digit = Base64::decode($c);
            $continuation = ($digit & self::VLQ_CONTINUATION_BIT) != 0;
            $digit &= self::VLQ_BASE_MASK;
            $result = $result + ($digit << $shift);
            $shift = $shift + self::VLQ_BASE_SHIFT;
        } while ($continuation);

        return self::fromVLQSigned($result);
    }
692261
private function doUnserialize($str)
    {
        $m = $this->allowedClasses ? @unserialize($str, [
            'allowed_classes' => $this->allowedClasses,
        ]) : @unserialize($str);

        if (false === $m) {
            $err = error_get_last();
            throw new SerializationError(sprintf(
                'Error unserializing message: %s', 
                $err && isset($err['message']) ? $err['message'] : 'unknown error'
            ));
        }

        return $m;
    }
1181303
function decode (str) {
  return str.trim().split(' ').map((s) => {
    if (s.charCodeAt(0) - 0x2800 > 127) return s
    return String.fromCharCode(s.charCodeAt(0) - 0x2800)
  }).join('')
}
1035532
public function logger($str)
    {
        if (is_object($this->QUERY_LOG) && method_exists($this->QUERY_LOG, 'debug')) {
            $this->QUERY_LOG->debug($str);

            return true;
        }

        return false;
    }