-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
[Yaml] Remove escaping regex #19782
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] Remove escaping regex #19782
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -684,7 +684,7 @@ public static function evaluateBinaryScalar($scalar) | |
|
||
private static function isBinaryString($value) | ||
{ | ||
return !preg_match('//u', $value) || preg_match('/[^\x09-\x0d\x20-\xff]/', $value); | ||
return !preg_match('//u', $value) || preg_match('/[^\x00-\x1f\x20-\xff]/', $value); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What's the reason for this change? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Because these caracters are escapable in double quoted strings There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah okay, maybe we should add a comment with some reference to an external source or something like that to help understanding the code. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. in fact i'm not even sure we should use |
||
} | ||
|
||
/** | ||
|
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.
BTW this fixes a "bug",
/
was missing.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.
Shouldn't this be done in 2.7 then?
Uh oh!
There was an error while loading. Please reload this page.
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.
It works in 2.7, it should be escaped but that's not mandatory.
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.
so why doing it then?
Uh oh!
There was an error while loading. Please reload this page.
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 that's not clear what we should do here. Non-printable characters must be escaped but
/
is a printable character (the spec says\/
is available for json compatibily), so I guess it's up to us to decide what to do.For readability
/
should indeed be better while\/
is more compliant with json. If you prefer/
I'll revert this change.