Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 1, 2017

Conversation

romainneutron
Copy link
Contributor

Q A
Branch? 2.7
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets N/A
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

@carsonbot carsonbot added the Bug label May 31, 2017
@romainneutron romainneutron changed the title [Form] Fix \IntlDateFormatter timezone parameter usage to bypass PHP bug #66323 [2.7][Form] Fix \IntlDateFormatter timezone parameter usage to bypass PHP bug #66323 May 31, 2017
@romainneutron romainneutron force-pushed the 2.7-intl-dateformatter branch from d234130 to 214fa1b Compare May 31, 2017 16:40
Copy link
Member

@nicolas-grekas nicolas-grekas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link
Contributor

@HeahDude HeahDude left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@@ -163,6 +163,10 @@ protected function getIntlDateFormatter($ignoreTimezone = false)
$dateFormat = $this->dateFormat;
$timeFormat = $this->timeFormat;
$timezone = $ignoreTimezone ? 'UTC' : $this->outputTimezone;
if (!defined('HHVM_VERSION') && PHP_VERSION_ID >= 50500) {
Copy link
Member

@nicolas-grekas nicolas-grekas May 31, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like this could enhance portability:

if (class_exists('IntlTimeZone', false)) {
    $timezone = \IntlTimeZone::createTimeZone($timezone)
}

@@ -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
defined('HHVM_VERSION') || PHP_VERSION_ID < 50500 ? null : new \DateTimeZone(date_default_timezone_get()),
Copy link
Member

@nicolas-grekas nicolas-grekas May 31, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

class_exists('IntlTimeZone', false) ? \IntlTimeZone::createDefault() : null

@romainneutron romainneutron force-pushed the 2.7-intl-dateformatter branch from 214fa1b to f42c73f Compare June 1, 2017 09:48
@romainneutron
Copy link
Contributor Author

PR updated, comments addressed

@nicolas-grekas
Copy link
Member

Thank you @romainneutron.

@nicolas-grekas nicolas-grekas merged commit f42c73f into symfony:2.7 Jun 1, 2017
nicolas-grekas added a commit that referenced this pull request Jun 1, 2017
…e 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
@romainneutron romainneutron deleted the 2.7-intl-dateformatter branch June 1, 2017 13:25
This was referenced Jun 5, 2017
@fabpot fabpot mentioned this pull request Jul 4, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants