Skip to content

Commit

Permalink
Fix: unreachable code typo
Browse files Browse the repository at this point in the history
  • Loading branch information
Grundik committed Jan 18, 2024
1 parent 1fed916 commit f41847e
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions src/Base64.php
Original file line number Diff line number Diff line change
Expand Up @@ -245,18 +245,12 @@ public static function decodeNoPadding(
return '';
}
if (($srcLen & 3) === 0) {
if ($encodedString[$srcLen - 1] === '=') {
// If $strLen is not zero and it is divisible by 4, then its at least 4.
if ($encodedString[$srcLen - 1] === '=' || $encodedString[$srcLen - 2] === '=') {
throw new InvalidArgumentException(
"decodeNoPadding() doesn't tolerate padding"
);
}
if (($srcLen & 3) > 1) {
if ($encodedString[$srcLen - 2] === '=') {
throw new InvalidArgumentException(
"decodeNoPadding() doesn't tolerate padding"
);
}
}
}
return static::decode(
$encodedString,
Expand Down

0 comments on commit f41847e

Please sign in to comment.