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
 [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

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-02-13 11:57 UTC] thies@php.net
fixed in CVS
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 27 15:01:29 2024 UTC