8000 minor #38231 [Validator] catch ValueError thrown on PHP 8 (xabbuh) · fancyweb/symfony@e299544 · GitHub
[go: up one dir, main page]

Skip to content

Commit e299544

Browse files
committed
minor symfony#38231 [Validator] catch ValueError thrown on PHP 8 (xabbuh)
This PR was merged into the 4.4 branch. Discussion ---------- [Validator] catch ValueError thrown on PHP 8 | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | | License | MIT | Doc PR | see php/php-src@95f4ee3 Commits ------- fb0d7be catch ValueError thrown on PHP 8
2 parents 785a066 + fb0d7be commit e299544

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/Symfony/Component/Validator/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)
0