From: jamaicafisk at gmail dot com
Operating system: Windows XP SP2
PHP version: 6CVS-2007-02-06 (snap)
PHP Bug Type: PostgreSQL related
Bug description: pg_set_client_encoding() and pg_client_encoding() are
inconsistent
Description:
------------
pg_set_client_encoding('UTF-8') returns 0 but a call to
pg_client_encoding() afterwards returns SQL_ASCII
The same code works on FreeBSD 6.2-RC1 and PHP 5.2.0 built against
Postgresql 8.2
Reproduce code:
---------------
<?php
pg_connect('host=localhost dbname=db user=myuser password=mypass');
echo "pg_set_client_encoding: " . pg_set_client_encoding('UTF-8') . "\n";
$res = pg_query('SHOW client_encoding;');
echo "client_encoding: " . pg_fetch_object($res)->client_encoding . "\n";
echo "pg_client_encoding: " . pg_client_encoding();
?>
Expected result:
----------------
pg_set_client_encoding: 0
client_encoding: UTF-8
pg_client_encoding: UTF-8
Actual result:
--------------
pg_set_client_encoding: 0
client_encoding: UTF-8
pg_client_encoding: SQL_ASCII
--
Edit bug report at http://bugs.php.net/?id=40371&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=40371&r=trysnapshot44
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=40371&r=trysnapshot52
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=40371&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=40371&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=40371&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=40371&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=40371&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=40371&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=40371&r=support
Expected behavior: http://bugs.php.net/fix.php?id=40371&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=40371&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=40371&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=40371&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=40371&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=40371&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=40371&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=40371&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=40371&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=40371&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=40371&r=mysqlcfg