-
Notifications
You must be signed in to change notification settings - Fork 7.7k
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
pdo_pgsql: question marks seen as parameter placeholders in dollar-quoted string #14244
Comments
As seen in SO "How to prevent PDO from interpreting a question mark as a placeholder?", there exists workarounds.
Another thought that complicates solving :-\ is that any solution that would remove the undesired translation would break the SQL of people relying on the first workaround. So maybe this will end in a "Won't fix", but with a clarification on the doc stating which combination of options (ATTR_EMULATE_PREPARES) will give pdo_pgsql the most direct-to-DB behaviour (and what to expect regarding other surprises. Perhaps a big table listing snippets of SQL, and for each combination of options what SQL gets effectively passed to the DB). |
This is somewhat on the radar as a side-effect of this: |
Allow "??" in dollar quoted strings for backwards compatibility, as it was a viable workaround to insert question marks without them being parsed as placeholders. Add a deprecation notice to tell that the escape is no longer necessary within dollar quotes and that its usage is deprecated. Ref bug #14244
Allow "??" in dollar quoted strings for backwards compatibility, as it was a viable workaround to insert question marks without them being parsed as placeholders. Add a deprecation notice to tell that the escape is no longer necessary within dollar quotes and that its usage is deprecated. Ref bug php#14244
Allow "??" in dollar quoted strings for backwards compatibility, as it was a viable workaround to insert question marks without them being parsed as placeholders. Add a deprecation notice to tell that the escape is no longer necessary within dollar quotes and that its usage is deprecated. Ref bug php#14244
Allow "??" in dollar quoted strings for backwards compatibility, as it was a viable workaround to insert question marks without them being parsed as placeholders. Add a deprecation notice to tell that the escape is no longer necessary within dollar quotes and that its usage is deprecated. Ref bug php#14244
Description
Dollar-quoting is a PostgreSQL way of quoting strings, and "no characters inside a dollar-quoted string are ever escaped" (see the official docs).
pdo_pgsql however sees ? as parameter placeholders (and replaces them with $1, $2, etc., when not emulating prepares which is the default mode).
See attached test case bug14244.phpt
PHP Version
PHP 8.2.1
The text was updated successfully, but these errors were encountered: