Skip to content

Commit

Permalink
[10.x] Prevent passing null to base64_decode in Encrypter (#49071)
Browse files Browse the repository at this point in the history
* Prevent passing null to base64_decode in Encrypter

* Implement styleCI recommended changes

* Update Encrypter.php

---------

Co-authored-by: Taylor Otwell <[email protected]>
  • Loading branch information
robtesch and taylorotwell authored Nov 21, 2023
1 parent 99d7395 commit 742f835
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Illuminate/Encryption/Encrypter.php
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,10 @@ protected function hash($iv, $value)
*/
protected function getJsonPayload($payload)
{
if (! is_string($payload)) {
throw new DecryptException('The payload is invalid.');
}

$payload = json_decode(base64_decode($payload), true);

// If the payload is not valid JSON or does not have the proper keys set we will
Expand Down

0 comments on commit 742f835

Please sign in to comment.