Skip to content

Commit 3a7c64f

Browse files
committed
catch ValueError thrown on PHP 8
1 parent 2a77bef commit 3a7c64f

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Constraints/TimezoneValidator.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,11 @@ public function validate($value, Constraint $constraint)
7878
private static function getPhpTimezones(int $zone, string $countryCode = null): array
7979
{
8080
if (null !== $countryCode) {
81-
return @\DateTimeZone::listIdentifiers($zone, $countryCode) ?: [];
81+
try {
82+
return @\DateTimeZone::listIdentifiers($zone, $countryCode) ?: [];
83+
} catch (\ValueError $e) {
84+
return [];
85+
}
8286
}
8387

8488
return \DateTimeZone::listIdentifiers($zone);

0 commit comments

Comments
 (0)