Skip to content

Commit 703f87b

Browse files
authored
Skip unnecessary check before calling openssl_encrypt (#40108)
1 parent 66e69a2 commit 703f87b

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

src/Illuminate/Encryption/Encrypter.php

+4-11
Original file line numberDiff line numberDiff line change
@@ -99,17 +99,10 @@ public function encrypt($value, $serialize = true)
9999
{
100100
$iv = random_bytes(openssl_cipher_iv_length(strtolower($this->cipher)));
101101

102-
$tag = '';
103-
104-
$value = self::$supportedCiphers[strtolower($this->cipher)]['aead']
105-
? \openssl_encrypt(
106-
$serialize ? serialize($value) : $value,
107-
strtolower($this->cipher), $this->key, 0, $iv, $tag
108-
)
109-
: \openssl_encrypt(
110-
$serialize ? serialize($value) : $value,
111-
strtolower($this->cipher), $this->key, 0, $iv
112-
);
102+
$value = \openssl_encrypt(
103+
$serialize ? serialize($value) : $value,
104+
strtolower($this->cipher), $this->key, 0, $iv, $tag
105+
);
113106

114107
if ($value === false) {
115108
throw new EncryptException('Could not encrypt the data.');

0 commit comments

Comments
 (0)