PHP 4.0 Bug #4230: pg_connect clears environment variables on a second connection establishment

From: Date: Tue, 25 Apr 2000 01:41:33 +0000
Subject: PHP 4.0 Bug #4230: pg_connect clears environment variables on a second connection establishment
Groups: php.dev 
Request: Send a blank email to php-dev+get-18170@lists.php.net to get a copy of this message
From: mlemos@acm.org Operating system: Linux RH 6 PHP version: 4.0 Release Candidate 1 PHP Bug Type: PostgreSQL related Bug description: pg_connect clears environment variables on a second connection establishment When pg_connect is opens a connections that is then closed and pg_connect is called again to open a connection again important environment variables like PG_DATESTYLE are cleared and the last connection is set as if that variable was not set. Try this script to replicate the problem. It doesn't happen at least in PHP 3.0.14. <? Function Connect(&$error) { if(!function_exists("pg_connect")) { $error="PostgreSQL support is not available in this PHP configuration"; return(0); } Putenv("PGUSER=root"); Putenv("PGPASSWORD="); Putenv("PGDATESTYLE=ISO"); $connection=pg_connect("","","template1"); echo "$connection \"".getenv("PGDATESTYLE"),"\" \"".getenv("PGUSER"),"\"\n"; if(($connection)>0) return($connection); $error=(IsSet($php_errormsg) ? $php_errormsg : "Could not connect to PostgreSQL server"); return(0); } $error=""; if(($connection=Connect(&$error))) { pg_Close($connection); if($connection=Connect(&$error)) pg_Close($connection); } if(strcmp($error,"")) echo "Error: $error\n"; ?>

« previous php.dev (#18170) next »