Bug #53127 [NEW]: pg_escape_bytea returns a format different from the expectation

From: Date: Thu, 21 Oct 2010 11:26:29 +0000
Subject: Bug #53127 [NEW]: pg_escape_bytea returns a format different from the expectation
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-155403@lists.php.net to get a copy of this message
From: Operating system: Linux kernel 2.6.27 PHP version: 5.3.3 Package: PostgreSQL related Bug Type: Bug Bug description:pg_escape_bytea returns a format different from the expectation Description: ------------ Using PostgreSQL 9.0.1, pg_escape_bytea function returns new "hex" format. By defaults, PostgreSQL outputs new "hex" format for bytea data. It is possible to change to "escape" format by modifying the postgresql.conf file. I expecting the test script displays "AAA" always. However, pg_escape_bytea actually returns a different ("hex") format while the database is connected. After disconnected, pg_escape_bytea returns correct ("escape") format. Test script: --------------- <?php $link = pg_connect('dbname=template1 user=postgres'); $version = pg_version($link); print "PostgreSQL version information\n"; var_dump($version); $result = pg_query($link,"show bytea_output"); $col = pg_fetch_row($result,0); pg_free_result($result); print "environment variable: bytea_output\n"; var_dump($col); print "pg_escape_bytea('AAA') before database connection closing\n"; print pg_escape_bytea('AAA')."\n"; pg_close($link); print "pg_escape_bytea('AAA') after database connection closing\n"; print pg_escape_bytea('AAA')."\n"; Expected result: ---------------- PostgreSQL version information array(3) { ["client"]=> string(5) "9.0.1" ["protocol"]=> int(3) ["server"]=> string(5) "9.0.1" } environment variable: bytea_output array(1) { [0]=> string(6) "escape" } pg_escape_bytea('AAA') before database connection closing AAA pg_escape_bytea('AAA') after database connection closing AAA Actual result: -------------- PostgreSQL version information array(3) { ["client"]=> string(5) "9.0.1" ["protocol"]=> int(3) ["server"]=> string(5) "9.0.1" } environment variable: bytea_output array(1) { [0]=> string(6) "escape" } pg_escape_bytea('AAA') before database connection closing \\x414141 pg_escape_bytea('AAA') after database connection closing AAA -- Edit bug report at http://bugs.php.net/bug.php?id=53127&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=53127&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=53127&r=trysnapshot53 Try a snapshot (trunk): http://bugs.php.net/fix.php?id=53127&r=trysnapshottrunk Fixed in SVN: http://bugs.php.net/fix.php?id=53127&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=53127&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=53127&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=53127&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=53127&r=needscript Try newer version: http://bugs.php.net/fix.php?id=53127&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=53127&r=support Expected behavior: http://bugs.php.net/fix.php?id=53127&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=53127&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=53127&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=53127&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=53127&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=53127&r=dst IIS Stability: http://bugs.php.net/fix.php?id=53127&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=53127&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=53127&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=53127&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=53127&r=mysqlcfg

« previous php.bugs (#155403) next »