-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
#20411 fix Yaml parsing for very long quoted strings #21279
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
Conversation
{ | ||
$longStringWithQuotes = str_repeat("x\r\n\\\"x\"x", 1000); | ||
|
||
$yamlString = Inline::dump(['longStringWithQuotes' => $longStringWithQuotes]); |
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.
the short array syntax does not work on PHP 5.3, which is still supported by Symfony 2.7. Please change it.
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.
Sorry, good point.
I've pushed a new version.
👍 (once the PHP 5.3 compat is fixed of course) |
100a0ce
to
51bca66
Compare
Thank you @RichardBradley. |
…ardBradley) This PR was merged into the 2.7 branch. Discussion ---------- #20411 fix Yaml parsing for very long quoted strings | Q | A | ------------- | --- | Branch? | 2.7 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #20411 | License | MIT | Doc PR | no This fixes #20411, a YAML string with too many backslash escapes can trigger a `PREG_BACKTRACK_LIMIT_ERROR` error in the Yaml parser. There should be no behavioural change other than the bug fix I have included a test which fails before this fix and passes after this fix. Commits ------- 51bca66 #20411 fix Yaml parsing for very long quoted strings
…ardBradley) This PR was squashed before being merged into the 2.7 branch (closes #21523). Discussion ---------- #20411 fix Yaml parsing for very long quoted strings | Q | A | ------------- | --- | Branch? | 2.7 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #20411 | License | MIT | Doc PR | no This is a second fix for the issue discussed in #20411. My first PR (#21279) didn't fix the bug in all cases, sorry. If a YAML string has too many spaces in the value, it can trigger a `PREG_BACKTRACK_LIMIT_ERROR` error in the Yaml parser. There should be no behavioural change other than the bug fix I have included a test which fails before this fix and passes after this fix. I have also added checks that detect other PCRE internal errors and throw a more descriptive exception. Before this patch, the YAML engine would often give incorrect results, rather than throwing, on a PCRE `PREG_BACKTRACK_LIMIT_ERROR` error. Commits ------- c9a1c09 #20411 fix Yaml parsing for very long quoted strings
This fixes #20411, a YAML string with too many backslash escapes can trigger a
PREG_BACKTRACK_LIMIT_ERROR
error in the Yaml parser.There should be no behavioural change other than the bug fix
I have included a test which fails before this fix and passes after this fix.