#45491 [NEW]: bytea values don't get escaped in pg_query_params and pg_execute
| From: | php at benjaminschulz dot com | Date: | Sat, 12 Jul 2008 08:32:25 +0000 |
| Subject: | #45491 [NEW]: bytea values don't get escaped in pg_query_params and pg_execute | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-126560@lists.php.net to get a copy of this message | ||
From: php at benjaminschulz dot com
Operating system: linux, darwin
PHP version: 5.3CVS-2008-07-12 (CVS)
PHP Bug Type: PostgreSQL related
Bug description: bytea values don't get escaped in pg_query_params and pg_execute
Description:
------------
It's not possible to pass bytea values to pg_query_params or pg_execute.
It seems like ext/pgsql does no escaping where it should. ext/pgsql is
built against libpq 8.3.1.
Reproduce code:
---------------
<?php
$conn = pg_connect(...);
pg_set_client_encoding($conn, 'UTF8');
$res = pg_query_params('SELECT $1::bytea', array("\xf6"));
var_dump(pg_fetch_array($res));
Expected result:
----------------
Some binary string :)
Actual result:
--------------
Warning: pg_query_params(): Query failed: ERROR: invalid byte sequence
for encoding "UTF8": 0xf6
HINT: This error can also happen if the byte sequence does not match the
encoding expected by the server, which is controlled by "client_encoding".
in ...
--
Edit bug report at http://bugs.php.net/?id=45491&edit=1
--
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=45491&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=45491&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=45491&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=45491&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=45491&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=45491&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=45491&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=45491&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=45491&r=support
Expected behavior: http://bugs.php.net/fix.php?id=45491&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=45491&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=45491&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=45491&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=45491&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=45491&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=45491&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=45491&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=45491&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=45491&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=45491&r=mysqlcfg