php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #7529 pg_connect() returns invalid connection id
Submitted: 2000-10-30 05:35 UTC Modified: 2001-02-13 12:10 UTC
From: sugino at mba dot nifty dot ne dot jp Assigned:
Status: Closed Package: PostgreSQL related
PHP Version: 4.0.3pl1 OS: Linux (Redhat 6.0)
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: sugino at mba dot nifty dot ne dot jp
New email:
PHP Version: OS:

 

 [2000-10-30 05:35 UTC] sugino at mba dot nifty dot ne dot 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



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-02-13 12:10 UTC] thies@php.net
believed to be fixed in CVS
 [2001-02-13 12:10 UTC] thies@php.net
believed to be fixed in CVS
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue May 06 17:02:17 2025 UTC