Skip to content
Permalink
Browse files

Fix: Validator::isRc not truncate leading zeros of date parts for mod…

…ulo calculation.
  • Loading branch information
DominikVisek authored and f3l1x committed Oct 5, 2019
1 parent 553397a commit 164d755f7bd0e243c28e7ea817f1781fc1dedc3f
Showing with 4 additions and 1 deletion.
  1. +4 −1 src/Validators.php
@@ -20,6 +20,9 @@ public static function isRc(string $rc): bool
}

[, $year, $month, $day, $ext, $c] = $matches;

$numberForModulo = (int) ($year . $month . $day . $ext);

$year = (int) $year;
$month = (int) $month;
$day = (int) $day;
@@ -30,7 +33,7 @@ public static function isRc(string $rc): bool
}

// check number
$mod = ($year . $month . $day . $ext) % 11;
$mod = $numberForModulo % 11;

if ($mod === 10) {
$mod = 0;

0 comments on commit 164d755

Please sign in to comment.
You can’t perform that action at this time.