Skip to content
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

[YAML] Fixed parsing problem with nested DateTime lists #19081

Merged
merged 2 commits into from Jun 17, 2016

Conversation

xabbuh
Copy link
Member

@xabbuh xabbuh commented Jun 17, 2016

Q A
Branch? 3.1
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets #19029
License MIT
Doc PR

The new handling for DateTimeInterface instances was introduced in Symfony 3.1.

@@ -397,7 +397,7 @@ private static function parseSequence($sequence, $flags, &$i = 0, $references =
$value = self::parseScalar($sequence, $flags, array(',', ']'), array('"', "'"), $i, true, $references);

// the value can be an array if a reference has been resolved to an array var
if (!is_array($value) && !$isQuoted && false !== strpos($value, ': ')) {
if (!is_array($value) && !$value instanceof \DateTimeInterface && !$isQuoted && false !== strpos($value, ': ')) {
Copy link
Member

Choose a reason for hiding this comment

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

I would replace the first parts by is_string($value). The strpos condition can pass only for strings anyway, not for integers or floats, so it is useless to try it for them

Copy link
Member Author

Choose a reason for hiding this comment

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

indeed, changed accordingly

@fabpot
Copy link
Member

fabpot commented Jun 17, 2016

Thank you @xabbuh.

@fabpot fabpot merged commit 0f47712 into symfony:3.1 Jun 17, 2016
fabpot added a commit that referenced this pull request Jun 17, 2016
…kphl, xabbuh)

This PR was merged into the 3.1 branch.

Discussion
----------

[YAML] Fixed parsing problem with nested DateTime lists

| Q             | A
| ------------- | ---
| Branch?       | 3.1
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #19029
| License       | MIT
| Doc PR        |

The new handling for `DateTimeInterface` instances was introduced in Symfony 3.1.

Commits
-------

0f47712 parse embedded mappings only if value is a string
4f13a76 [YAML] Fixed parsing problem with nested DateTime lists
@xabbuh xabbuh deleted the backport-19029 branch June 17, 2016 14:25
@fabpot fabpot mentioned this pull request Jun 30, 2016
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.

None yet

5 participants