From 8c797aaba161f4f2a774ce393dbe6158a5999e04 Mon Sep 17 00:00:00 2001 From: Kijin Sung Date: Sun, 7 May 2017 15:29:21 +0900 Subject: [PATCH] Pass through crypto exceptions --- common/framework/security.php | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/common/framework/security.php b/common/framework/security.php index c4e8565d9..809ee359f 100644 --- a/common/framework/security.php +++ b/common/framework/security.php @@ -60,14 +60,7 @@ class Security // Use defuse/php-encryption if possible. if (!$force_compat && function_exists('openssl_encrypt')) { - try - { - return base64_encode(\Crypto::Encrypt($plaintext, $key)); - } - catch (\Exception $e) - { - return false; - } + return base64_encode(\Crypto::Encrypt($plaintext, $key)); } // Otherwise, use the CryptoCompat class. @@ -102,7 +95,7 @@ class Security { return \Crypto::Decrypt($ciphertext, $key); } - catch (\Exception $e) + catch (\InvalidCiphertextException $e) { return false; }