Skip to content

Commit

Permalink
bug #31865 [Form] Fix wrong DateTime on outdated ICU library (aweelex)
Browse files Browse the repository at this point in the history
This PR was merged into the 3.4 branch.

Discussion
----------

[Form] Fix wrong DateTime on outdated ICU library

| Q | A |
| --- | --- |
| Branch? | 3.4 |
| Bug fix? | Yes |
| New feature? | No |
| BC breaks? | No |
| Deprecations? | No |
| Tests pass? | Yes |
| Fixed tickets | --- |
| License | MIT |

There is a problem, when server uses outdated version of ICU (php-intl).

It throws no exeption or debug message on unexisting Timezone. So sometimes you can get wrong DateTime in Forms, because Intl uses 'Etc/Unknown' (UTC+0) instead correct Timezone. And it happens very unobvious.

I added `\IntlExeption` for that cases.

Commits
-------

a6025ab Change IntlTimeZone to DateTimeZone
  • Loading branch information
fabpot committed Jun 6, 2019
2 parents 04c6c92 + a6025ab commit 9691519
Showing 1 changed file with 2 additions and 5 deletions.
Expand Up @@ -162,11 +162,8 @@ protected function getIntlDateFormatter($ignoreTimezone = false)
{
$dateFormat = $this->dateFormat;
$timeFormat = $this->timeFormat;
$timezone = $ignoreTimezone ? 'UTC' : $this->outputTimezone;
if (class_exists('IntlTimeZone', false)) {
// see https://bugs.php.net/bug.php?id=66323
$timezone = \IntlTimeZone::createTimeZone($timezone);
}
$timezone = new \DateTimeZone($ignoreTimezone ? 'UTC' : $this->outputTimezone);

$calendar = $this->calendar;
$pattern = $this->pattern;

Expand Down

0 comments on commit 9691519

Please sign in to comment.