php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #38014 Reference counting problem in (at least?) PostgreSQL
Submitted: 2006-07-05 11:34 UTC Modified: 2006-07-05 12:06 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: unex at linija dot org Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 5.1.4 OS: *BSD, but probably independent
Private report: No CVE-ID: None
 [2006-07-05 11:34 UTC] unex at linija dot org
Description:
------------
Seems there is a problem with reference counting. The further example shows how pg_close() dereferences connection instead of just closing one.

I'm not sure how PHP works, but this problem could exist deeper than in PostgreSQL extension, but that's really yours competence.

Thanks.

Reproduce code:
---------------
<?
$Con1 = pg_connect("dbname=template1");
$Con2 = pg_connect("dbname=template1");

pg_close($Con1);

if(!ping($Con2)) echo "Connection 2 was closed too";
else pg_close($Con2);

?>

Expected result:
----------------
Only first connection should be closed.

Actual result:
--------------
Both connections was closed.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-07-05 11:37 UTC] derick@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

.
 [2006-07-05 11:43 UTC] tony2001@php.net
http://php.net/pg_connect

If a second call is made to pg_connect() with the same connection_string as an existing connection, the existing connection will be returned unless you pass PGSQL_CONNECT_FORCE_NEW as connect_type.
 [2006-07-05 12:06 UTC] unex at linija dot org
If you will use different databases - same problem exists. So it is a bug.
Sorry for misunderstand.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Dec 03 20:00:01 2025 UTC