From ed563a625be0685d3f15ddaca835578e86bcb853 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Friedrich=20Dreyer?= Date: Thu, 21 Jul 2022 08:28:02 +0000 Subject: [PATCH] use typesafe comparison MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jörn Friedrich Dreyer --- lib/Crypto/Crypt.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/Crypto/Crypt.php b/lib/Crypto/Crypt.php index cd4e176..25c898d 100644 --- a/lib/Crypto/Crypt.php +++ b/lib/Crypto/Crypt.php @@ -262,7 +262,7 @@ private function encrypt($plainContent, $iv, $passPhrase = '', $cipher = self::D $iv ); - if (!$encryptedContent) { + if ($encryptedContent === false) { $error = 'Encryption (symmetric) of content failed'; $this->logger->error( $error . \openssl_error_string(), @@ -628,11 +628,11 @@ private function decrypt($encryptedContent, $iv, $passPhrase = '', $cipher = sel $iv ); - if ($plainContent) { - return $plainContent; - } else { + if ($plainContent === false) { throw new DecryptionFailedException('Encryption library: Decryption (symmetric) of content failed: ' . \openssl_error_string()); } + + return $plainContent; } /**