Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 9691519

Browse filesBrowse files
committed
bug #31865 [Form] Fix wrong DateTime on outdated ICU library (aweelex)
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
2 parents 04c6c92 + a6025ab commit 9691519
Copy full SHA for 9691519

File tree

1 file changed

+2
-5
lines changed
Filter options

1 file changed

+2
-5
lines changed

‎src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToLocalizedStringTransformer.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToLocalizedStringTransformer.php
+2-5Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -162,11 +162,8 @@ protected function getIntlDateFormatter($ignoreTimezone = false)
162162
{
163163
$dateFormat = $this->dateFormat;
164164
$timeFormat = $this->timeFormat;
165-
$timezone = $ignoreTimezone ? 'UTC' : $this->outputTimezone;
166-
if (class_exists('IntlTimeZone', false)) {
167-
// see https://bugs.php.net/bug.php?id=66323
168-
$timezone = \IntlTimeZone::createTimeZone($timezone);
169-
}
165+
$timezone = new \DateTimeZone($ignoreTimezone ? 'UTC' : $this->outputTimezone);
166+
170167
$calendar = $this->calendar;
171168
$pattern = $this->pattern;
172169

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.