minor #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@95f4ee38bb
Commits
-------
fb0d7beaaf
catch ValueError thrown on PHP 8
This commit is contained in:
commit
e299544639
@ -78,7 +78,11 @@ class TimezoneValidator extends ConstraintValidator
|
||||
private static function getPhpTimezones(int $zone, string $countryCode = null): array
|
||||
{
|
||||
if (null !== $countryCode) {
|
||||
try {
|
||||
return @\DateTimeZone::listIdentifiers($zone, $countryCode) ?: [];
|
||||
} catch (\ValueError $e) {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
return \DateTimeZone::listIdentifiers($zone);
|
||||
|
Reference in New Issue
Block a user