PHP 4.0 Bug #5862: Consecutive pg_open statements cause second statement to fail
| From: | reinke at e-softinc dot com | Date: | Sun, 30 Jul 2000 16:47:28 +0000 |
| Subject: | PHP 4.0 Bug #5862: Consecutive pg_open statements cause second statement to fail | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-26974@lists.php.net to get a copy of this message | ||
From: reinke@e-softinc.com
Operating system: Linux RedHat 6.2
PHP version: 4.0.1pl2
PHP Bug Type: PostgreSQL related
Bug description: Consecutive pg_open statements cause second statement to fail
Using PostGres 7.0.2, and the latest PHP, any script that
would choose to open a database connection a second time
will fail.
For example:
<?
$pg = pg_connect("dbname=customer");
$res = pg_exec("select count(*) from list_weeklynews;");
pg_close($pg);
$pg = pg_connect("dbname=customer");
$res = pg_exec("select count(*) from list_weeklynews;");
pg_close($pg);
?>
The second connect fails with:
1 is not a valid PostgreSQL link resource in file.php
Repeating the 3 lines multiple times in the script does pretty
unusual stuff - the file descriptor is bouncing all over the place -
if file descriptors were properly closed, the same descriptor
would in all likelihood be re-used