php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #5862 Consecutive pg_open statements cause second statement to fail
Submitted: 2000-07-30 18:47 UTC Modified: 2001-02-13 11:57 UTC
From: reinke at e-softinc dot com Assigned:
Status: Closed Package: PostgreSQL related
PHP Version: 4.0.1pl2 OS: Linux RedHat 6.2
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: reinke at e-softinc dot com
New email:
PHP Version: OS:

 

 [2000-07-30 18:47 UTC] reinke at e-softinc dot com
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


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-02-13 11:57 UTC] thies@php.net
fixed in CVS
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue May 06 16:01:28 2025 UTC