-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Support for backslashes in default values #2850
Changes from all commits
bd465f7
26658ab
b83ba1a
b841ba7
4851fc0
7e65c84
44637bf
5da4c33
a50a029
6e920f3
255e112
87c417f
9f32154
fa9e2b1
2971f86
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 |
---|---|---|
|
@@ -1236,4 +1236,12 @@ private function isNumericType(Type $type) : bool | |
{ | ||
return $type instanceof IntegerType || $type instanceof BigIntType; | ||
} | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
protected function quoteDefaultStringLiteral(string $str) : string | ||
{ | ||
return parent::quoteStringLiteral($str); | ||
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. Why is it required to escape the default value in a different way than other literals for PostgreSQL? 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 PostgreSQL does not support backlash C-style escapes out of the box, the
This means we cannot use I wish it was not needed, but I don't say another way around... 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. scratch that last comment of mine, I'll think a bit more about that... 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. The fact that 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. I don't understand what you mean by that. 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. @PowerKiKi I don't remember what I meant by that 😕. |
||
} | ||
} |
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.
Given that
quoteStringLiteral()
only escapes quotes and backslashes by means ofstr_replace()
, it may not work with encodings where the0x27
byte (the single quote in ASCII) is part of a multi-byte sequence.This approach to escaping is used everywhere on the platform level, so it'd be good to hear from other maintainers whether this approach is valid in general.
/cc @Ocramius @lcobucci
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.
This seems to only affect schema definitions, so I'm not too worried about it for now. It is a problem if people rely on it for anything runtime-related.