PHP 4.0 Bug #7529 Updated: pg_connect() returns invalid connection id
| From: | thies@php.net | Date: | Tue, 13 Feb 2001 17:10:30 +0000 |
| Subject: | PHP 4.0 Bug #7529 Updated: pg_connect() returns invalid connection id | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-46493@lists.php.net to get a copy of this message | ||
ID: 7529
Updated by: thies
Reported By: sugino@mba.nifty.ne.jp
Status: Open
Bug Type: PostgreSQL related
Assigned To:
Comments:
believed to be fixed in CVS
Previous Comments:
---------------------------------------------------------------------------
[2000-10-30 05:35:22] sugino@mba.nifty.ne.jp
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
---------------------------------------------------------------------------
ATTENTION! Do NOT reply to this email!
To reply, use the web interface found at http://bugs.php.net/?id=7529&edit=2