Skip to content

throw on null bytes / resolve GH-13952 #18320

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

Closed
wants to merge 8 commits into from

Conversation

divinity76
Copy link
Contributor

fix a corruption issue where PDO::quote for SQLite would silently truncate strings with null bytes in them,
by throwing.

resolve GH-13952
close GH-13972

fix a corruption issue where PDO::quote for SQLite would silently truncate strings with
null bytes in them,
 by throwing.

resolve phpGH-13952
close phpGH-13972
Copy link
Member

@nielsdos nielsdos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Waiting for @SakiTakamachi 's final approval, but this LGTM

Copy link
Member

@SakiTakamachi SakiTakamachi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I looked for a suitable SQL state, but couldn’t find one that fits well, so the current code seems to be the best option, thanks!

edit:
I’m out right now, but if it hasn’t been merged by the time I get back, I’ll merge it then :)

@divinity76
Copy link
Contributor Author

divinity76 commented Apr 14, 2025

maybe sqlstate 22004 22029?

quoting ansi SQL:2011 draft at https://web.archive.org/web/20230525220603if_/https://www.wiscorp.com/sql20nn.zip
7IWD2-02-Foundation-2011-12.pdf

13.3 <externally-invoked procedure>
(...)
 constant SQLSTATE_TYPE :="22029";
    DATA_EXCEPTION_NULL_VALUE_NOT_ALLOWED:

or maybe 39000

 constant SQLSTATE_TYPE :="39000";
    EXTERNAL_ROUTINE_INVOCATION_EXCEPTION_NULL_VALUE_NOT_ALLOWED
  • final released ansi sql standards cost like 600USD, while drafts are available for free.

@SakiTakamachi
Copy link
Member

In my view, none of them seem appropriate.
I interpret “null value” as referring to a value that is null itself, not a value that contains null.

Also, I’m not sure whether this can be referred to as an “external routine.”

@SakiTakamachi
Copy link
Member

Merged :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

sqlite PDO::quote silently corrupts strings with null bytes
3 participants