Skip to content

Commit

Permalink
Remove length test
Browse files Browse the repository at this point in the history
The regex already covers this
  • Loading branch information
tvdijen authored Jan 13, 2025
1 parent f35e26e commit a6c4d9d
Showing 1 changed file with 0 additions and 2 deletions.
2 changes: 0 additions & 2 deletions src/Base64Trait.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ protected static function validBase64(string $value, string $message = ''): void

if (filter_var($value, FILTER_VALIDATE_REGEXP, ['options' => ['regexp' => self::$base64_regex]]) === false) {
$result = false;
} elseif (strlen($value) % 4 !== 0) {
$result = false;
} else {
$decoded = base64_decode($value, true);
if (empty($decoded)) { // Invalid _or_ empty string
Expand Down

0 comments on commit a6c4d9d

Please sign in to comment.