[Form] Fix \IntlDateFormatter timezone parameter usage to bypass PHP bug #66323

This commit is contained in:
Romain Neutron 2017-05-31 17:48:21 +02:00
parent aa04f35092
commit f42c73f213
No known key found for this signature in database
GPG Key ID: 201FC7CF9F0CA3ED
2 changed files with 6 additions and 1 deletions

View File

@ -163,6 +163,10 @@ class DateTimeToLocalizedStringTransformer extends BaseDateTimeTransformer
$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);
}
$calendar = $this->calendar;
$pattern = $this->pattern;

View File

@ -77,7 +77,8 @@ class DateType extends AbstractType
\Locale::getDefault(),
$dateFormat,
$timeFormat,
null,
// see https://bugs.php.net/bug.php?id=66323
class_exists('IntlTimeZone', false) ? \IntlTimeZone::createDefault() : null,
$calendar,
$pattern
);