Skip to content

Commit 2748457

Browse files
committed
version
2 parents 31e6062 + 33b1b98 commit 2748457

File tree

3 files changed

+26
-11
lines changed

3 files changed

+26
-11
lines changed

src/Illuminate/Encryption/Encrypter.php

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -152,11 +152,9 @@ public function decrypt($payload, $unserialize = true)
152152

153153
$iv = base64_decode($payload['iv']);
154154

155-
$tag = empty($payload['tag']) ? null : base64_decode($payload['tag']);
156-
157-
if (self::$supportedCiphers[strtolower($this->cipher)]['aead'] && strlen($tag) !== 16) {
158-
throw new DecryptException('Could not decrypt the data.');
159-
}
155+
$this->ensureTagIsValid(
156+
$tag = empty($payload['tag']) ? null : base64_decode($payload['tag'])
157+
);
160158

161159
// Here we will decrypt the value. If we are able to successfully decrypt it
162160
// we will then unserialize it and return it out to the caller. If we are
@@ -248,6 +246,23 @@ protected function validMac(array $payload)
248246
);
249247
}
250248

249+
/**
250+
* Ensure the given tag is a valid tag given the selected cipher.
251+
*
252+
* @param string $tag
253+
* @return void
254+
*/
255+
protected function ensureTagIsValid($tag)
256+
{
257+
if (self::$supportedCiphers[strtolower($this->cipher)]['aead'] && strlen($tag) !== 16) {
258+
throw new DecryptException('Could not decrypt the data.');
259+
}
260+
261+
if (! self::$supportedCiphers[strtolower($this->cipher)]['aead'] && is_string($tag)) {
262+
throw new DecryptException('Unable to use tag because the cipher algorithm does not support AEAD.');
263+
}
264+
}
265+
251266
/**
252267
* Get the encryption key that the encrypter is currently using.
253268
*

src/Illuminate/Foundation/Application.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class Application extends Container implements ApplicationContract, CachesConfig
3535
*
3636
* @var string
3737
*/
38-
const VERSION = '9.4.1';
38+
const VERSION = '9.5.0';
3939

4040
/**
4141
* The base path for the Laravel installation.

src/Illuminate/Http/Client/PendingRequest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1041,11 +1041,11 @@ protected function sinkStubHandler($sink)
10411041
public function runBeforeSendingCallbacks($request, array $options)
10421042
{
10431043
return tap($request, function ($request) use ($options) {
1044-
$this->beforeSendingCallbacks->each->__invoke(
1045-
(new Request($request))->withData($options['laravel_data']),
1046-
$options,
1047-
$this
1048-
);
1044+
$this->beforeSendingCallbacks->each(function ($callback) use ($request, $options) {
1045+
call_user_func(
1046+
$callback, (new Request($request))->withData($options['laravel_data']), $options, $this
1047+
);
1048+
});
10491049
});
10501050
}
10511051

0 commit comments

Comments
 (0)