bug #22996 [2.7][Form] Fix \IntlDateFormatter timezone parameter usage to bypass PHP bug #66323 (romainneutron)
This PR was merged into the 2.7 branch.
Discussion
----------
[2.7][Form] Fix \IntlDateFormatter timezone parameter usage to bypass PHP bug #66323
| Q | A
| ------------- | ---
| Branch? | 2.7
| Bug fix? | yes
| New feature? | no <!-- don't forget updating src/**/CHANGELOG.md files -->
| BC breaks? | no
| Deprecations? | no <!-- don't forget updating UPGRADE-*.md files -->
| Tests pass? | yes
| Fixed tickets | N/A <!-- #-prefixed issue number(s), if any -->
| License | MIT
| Doc PR | N/A
The issue is documented here.
The current symfony code works when `intl.use_exception` is off. however, it's on on PHP 7+ and the issue is reproducible. See https://3v4l.org/PllP1 and https://3v4l.org/3XnKI
Commits
-------
f42c73f
[Form] Fix \IntlDateFormatter timezone parameter usage to bypass PHP bug #66323
This commit is contained in:
commit
36bd06a152
@ -163,6 +163,10 @@ class DateTimeToLocalizedStringTransformer extends BaseDateTimeTransformer
|
|||||||
$dateFormat = $this->dateFormat;
|
$dateFormat = $this->dateFormat;
|
||||||
$timeFormat = $this->timeFormat;
|
$timeFormat = $this->timeFormat;
|
||||||
$timezone = $ignoreTimezone ? 'UTC' : $this->outputTimezone;
|
$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;
|
$calendar = $this->calendar;
|
||||||
$pattern = $this->pattern;
|
$pattern = $this->pattern;
|
||||||
|
|
||||||
|
@ -77,7 +77,8 @@ class DateType extends AbstractType
|
|||||||
\Locale::getDefault(),
|
\Locale::getDefault(),
|
||||||
$dateFormat,
|
$dateFormat,
|
||||||
$timeFormat,
|
$timeFormat,
|
||||||
null,
|
// see https://bugs.php.net/bug.php?id=66323
|
||||||
|
class_exists('IntlTimeZone', false) ? \IntlTimeZone::createDefault() : null,
|
||||||
$calendar,
|
$calendar,
|
||||||
$pattern
|
$pattern
|
||||||
);
|
);
|
||||||
|
Reference in New Issue
Block a user