|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2010-10-22 09:07 UTC] aharvey@php.net
-Status: Open
+Status: Wont fix
[2010-10-22 09:07 UTC] aharvey@php.net
[2011-09-27 04:35 UTC] zlobnynigga at yandex dot ru
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Nov 03 07:00:01 2025 UTC |
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