Skip to content

Commit

Permalink
[Form] Fix \IntlDateFormatter timezone parameter usage to bypass PHP …
Browse files Browse the repository at this point in the history
…bug #66323
  • Loading branch information
romainneutron committed Jun 1, 2017
1 parent aa04f35 commit f42c73f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Expand Up @@ -163,6 +163,10 @@ 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);
}
$calendar = $this->calendar;
$pattern = $this->pattern;

Expand Down
3 changes: 2 additions & 1 deletion src/Symfony/Component/Form/Extension/Core/Type/DateType.php
Expand Up @@ -77,7 +77,8 @@ public function buildForm(FormBuilderInterface $builder, array $options)
\Locale::getDefault(),
$dateFormat,
$timeFormat,
null,
// see https://bugs.php.net/bug.php?id=66323
class_exists('IntlTimeZone', false) ? \IntlTimeZone::createDefault() : null,
$calendar,
$pattern
);
Expand Down

0 comments on commit f42c73f

Please sign in to comment.