PHP 4.0 Bug #7529: pg_connect() returns invalid connection id
| From: | sugino at mba dot nifty dot ne dot jp | Date: | Mon, 30 Oct 2000 10:35:22 +0000 |
| Subject: | PHP 4.0 Bug #7529: pg_connect() returns invalid connection id | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-36388@lists.php.net to get a copy of this message | ||
From: sugino@mba.nifty.ne.jp
Operating system: Linux (Redhat 6.0)
PHP version: 4.0.3pl1
PHP Bug Type: PostgreSQL related
Bug description: pg_connect() returns invalid connection id
Assuming that both pg_connect() and pg_close() are called
inside a function, and then pg_connect() is called again
from the main program, the next error will occur:
"Warning: 1 is not a valid PostgreSQL link resource in ..."
examples:
1. NG
function foo() {
$conn = pg_connect(...);
...
pg_close($conn);
}
foo(); # calls pg_connect() and pg_close()
$conn = pg_connect(...); # returns invalid connection id
2. OK
$conn = 0; # defines $conn as a global variable
function foo() {
global $conn;
$conn = pg_connect(...);
...
pg_close($conn);
}
foo(); # calls pg_connect() and pg_close()
$conn = pg_connect(...); # returns VALID connection id
--
Edit Bug report at: http://bugs.php.net/?id=7529&edit=1