-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Yaml] Fix String offset cast error in Inline parser #20335
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] Fix String offset cast error in Inline parser #20335
Conversation
romainneutron
commented
Oct 28, 2016
Q | A |
---|---|
Branch? | 3.2/master |
Bug fix? | yes |
New feature? | no |
BC breaks? | no |
Deprecations? | no |
Tests pass? | yes |
Fixed tickets | N/A |
License | MIT |
*/ | ||
public function testStringOffsetCastError() | ||
{ | ||
Inline::parse('{this, is not, yaml}'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually this is valid and should be equivalent to { this: ~, is not: ~, yaml: ~ }
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right. But this string wasn't even parsed before, was it? But we should nonetheless choose a better failing test case here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Honestly i have no idea if it worked, this part of the code is really hard to understand and i'm certain it leads to unexpected behaviors (by reading it, i think { foo bar }
results to { foo: bar }
).
I don't think this is the right fix even if it would prevent some unexpected behaviors, this part of the code has to be rewritten to be clearer and more testable.
BTW my PR already fixes that but does a lot of stuff at the same time. |
As we're already in a release candidate status for 3.2, adding new features is not possible. If you have a better fix, just let me know @Ener-Getick . This patch solves an issue in the current version |
|
👍 |
I reviewed your pr again and it looks like indeed that the input you test resulted at least in a warning as @nicolas-grekas said. |
Checked: this is for master only, 2.7 already fails properly here, the strpos is new to 3.2. |
See #20388 on 2.7 |
Thank you @romainneutron. |
…inneutron) This PR was merged into the 3.2-dev branch. Discussion ---------- [Yaml] Fix String offset cast error in Inline parser | Q | A | | --- | --- | | Branch? | 3.2/master | | Bug fix? | yes | | New feature? | no | | BC breaks? | no | | Deprecations? | no | | Tests pass? | yes | | Fixed tickets | N/A | | License | MIT | Commits ------- bc095a5 [Yaml] Fix String offset cast error in Inline parser
This PR was merged into the 2.7 branch. Discussion ---------- [Yaml] Clean some messages + add test case | Q | A | ------------- | --- | Branch? | 2.7 | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - Related to #20335 on 3.2. Commits ------- 7520f7b [Yaml] Clean some messages + add test case
This PR was merged into the 3.2 branch. Discussion ---------- [Yaml] consistently parse omitted keys as the colon | Q | A | ------------- | --- | Branch? | 3.2 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | | License | MIT | Doc PR | Before the changes made in #20335, an empty mapping key was parsed as `:`. This behaviour is not correct according to the spec, but we should keep the parser behaviour consistent to not break backward compatibility (I will deprecate it in a different PR on `master`). Commits ------- e2ebecc consistently parse omitted keys as the colon