2 Commits
Author SHA1 Message Date
andrew 371d1cebb0 Update src/Data/Payload.php
Sync GitHub / sync (push) Successful in 6s
Tests / test (pull_request) Failing after 1m1s
updated to match psr12
2026-08-11 09:32:54 -04:00
andrew e4f5e046f6 Update src/Data/Payload.php
Sync GitHub / sync (push) Successful in 7s
Tests / test (pull_request) Failing after 56s
simplify the fix for the decoding, while still resolving the issue.
2026-08-11 09:27:08 -04:00
+5 -3
View File
@@ -19,9 +19,11 @@ final class Payload
public static function decode(string $base64url): ?Payload
{
/* convert the base64url into json string */
$base64 = strtr($base64url, '-_', '+/');
$base64 .= str_repeat('=', (4 - strlen($base64) % 4) % 4);
$json = base64_decode($base64, true);
$json = base64_decode(str_pad(
strtr($base64url, '-_', '+/'),
strlen($base64url) + strlen($base64url) % 4,
'='
), true);
if ($json) {
/* convert the json string into real data */
$data = json_decode($json);