浏览代码

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

Zhu Jinhui 7 年之前
父节点
当前提交
474f20b092
共有 1 个文件被更改,包括 6 次插入2 次删除
  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);
 	}