Req #63344 [Asn->Wfx]: pg_query_params() doesn't pass parts of strings past zero byte character
| From: | yohgaki@php.net | Date: | Mon, 08 Jul 2013 10:39:18 +0000 |
| Subject: | Req #63344 [Asn->Wfx]: pg_query_params() doesn't pass parts of strings past zero byte character | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-180128@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=63344&edit=1
ID: 63344
Updated by: yohgaki@php.net
Reported by: peter dot kehl at gmail dot com
Summary: pg_query_params() doesn't pass parts of strings past
zero byte character
-Status: Assigned
+Status: Wont fix
Type: Feature/Change Request
Package: PostgreSQL related
Operating System: CentOS 6.2; possibly irrelevant
PHP Version: 5.4.8
Assigned To: yohgaki
Block user comment: N
Private report: N
New Comment:
We discussed this issue and decided not to implement this feature.
You cannot insert string contains null as UTF-8.
If you are using bytea, make sure you use pg_escape_bytea()/pg_unescape_bytea()
even with prepared query type API.
We may implement API supports direct bytea in the future, but it requires libpq
support which is not available now.
Previous Comments:
------------------------------------------------------------------------
[2013-06-29 20:09:25] yohgaki@php.net
This requires API change. Change bug type.
------------------------------------------------------------------------
[2013-04-16 19:32:18] yohgaki@php.net
I realized this issue years ago.
We need to add correct length parameter for string.
The reason why I didn't fix this is there might be users using pg_escate_bytea()
for prepared queries.
I can simply fix, but there is slight BC issue.
------------------------------------------------------------------------
[2012-10-25 01:00:30] peter dot kehl at gmail dot com
OK, pg_query_params() works as defined by Postgres. Thank you.
However, I suggest a change of Example #1 at http://www.php.net/serialize. That example saves a result of
serialize() to an ODBC database. I have no way of testing whether that works with strings containing
zero byte(s). Anyway, that example may lead people to save a result of serialize() using Postgres
(or MSSQL mssql_query()), which fail.
Please change that example to use base64_encode() and base64_decode(), and add a note that
serialize() generates a string which may contain zero byte(s).
------------------------------------------------------------------------
[2012-10-24 06:35:04] laruence@php.net
The following patch has been added/updated:
Patch Name: bug63344.patch
Revision: 1351060504
URL: https://bugs.php.net/patch-display.php?bug=63344&patch=bug63344.patch&revision=1351060504
------------------------------------------------------------------------
[2012-10-24 06:34:33] laruence@php.net
according to http://www.postgresql.org/docs/8.0/static/libpq-exec.html
the current PHP's wrapper of PQexecParams doesn't support binary data.
a simple fix is attached
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=63344
--
Edit this bug report at https://bugs.php.net/bug.php?id=63344&edit=1