Explorar o código

增加空字符串就不解码逻辑

Zhu Jinhui %!s(int64=7) %!d(string=hai) anos
pai
achega
474f20b092
Modificáronse 1 ficheiros con 6 adicións e 2 borrados
  1. 6 2
      src/Library/Crypt.php

+ 6 - 2
src/Library/Crypt.php

@@ -145,8 +145,12 @@ class Crypt
 	public function decrypt($string)
 	{
 		$string = str_replace(' ', '+', $string);
-		$string = base64_decode($this->verifyString($string));
-
+		$string = $this->verifyString($string);
+		if(!$string)
+        {
+            return '';
+        }
+		$string = base64_decode($string);
 		$passCrypt = openssl_decrypt($string, 'aes-256-cbc', $this->securityKey, OPENSSL_RAW_DATA, $this->getIv());
 		return substr($passCrypt, 10);
 	}