Bug #73250 [NEW]: pg_convert doesn't support bytea
| From: | hans at xs4all dot nl | Date: | Wed, 05 Oct 2016 09:35:42 +0000 |
| Subject: | Bug #73250 [NEW]: pg_convert doesn't support bytea | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-204467@lists.php.net to get a copy of this message | ||
From: hans at xs4all dot nl
Operating system: Linux
PHP version: 5.6.26
Package: PostgreSQL related
Bug Type: Bug
Bug description:pg_convert doesn't support bytea
Description:
------------
When a bytea value is passed to pg_convert, it returns the output of
pg_escape_bytea (bytea hex format in PostgreSQL 9+, see
https://www.postgresql.org/docs/9.3/static/datatype-binary.html#AEN5385
) enclosed in single quotes with the letter E prepended (an escape
string constant). But it does not convert the backslash at the beginning
to a double backslash. It should either convert \ to \\, or it should
not prepend the E (normal string constant).
(Tested using PostgreSQL 9.3.14)
Test script:
---------------
$db = pg_connect('dbname=foo');
pg_query($db, 'create table image (data bytea)');
$vals = ['data' => file_get_contents('image.png')];
print_r(pg_convert($db, 'image', $vals));
Expected result:
----------------
Array
(
["data"] => E'\\x89504e47........
or:
Array
(
["data"] => '\x89504e47........
Actual result:
--------------
Array
(
["data"] => E'\x89504e47........
--
Edit bug report at https://bugs.php.net/bug.php?id=73250&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=73250&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=73250&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=73250&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=73250&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=73250&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=73250&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=73250&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=73250&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=73250&r=support
Expected behavior: https://bugs.php.net/fix.php?id=73250&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=73250&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=73250&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=73250&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=73250&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=73250&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=73250&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=73250&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=73250&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=73250&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=73250&r=mysqlcfg