PHP 4.0 Bug #9746 Updated: pg_close (or autoclose) closes wrong connections
| From: | rich at horde dot org | Date: | Wed, 14 Mar 2001 20:37:29 +0000 |
| Subject: | PHP 4.0 Bug #9746 Updated: pg_close (or autoclose) closes wrong connections | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-48944@lists.php.net to get a copy of this message | ||
ID: 9746
User Update by: rich@horde.org
Old-Status: Feedback
Status: Open
Bug Type: PostgreSQL related
Description: pg_close (or autoclose) closes wrong connections
I tried with php4-200103141145; still as described above.
Previous Comments:
---------------------------------------------------------------------------
[2001-03-14 15:37:28] rich@horde.org
I tried with php4-200103141145; still as described above.
---------------------------------------------------------------------------
[2001-03-14 16:21:41] rich@horde.org
I recall this coming up before, but I can't find it in the list of open or closed postgres
bugs.
It appears as though PHP is using the arguments to pg_connect to uniquely identify connections. For
example:
$dba = pg_connect("user=foo pass=bar dbname=baz");
$dbb = pg_connect("user=foo pass=bar dbname=baz");
pg_close($dba);
# $dbb is closed now too
Were one to use $dbb at this point, one would see
PHP Warning: 1 is not a valid PostgreSQL link resource in [file] at [line].
But,
$dba = pg_connect("user=foo pass=bar dbname=baz");
$dbb = pg_connect("pass=bar user=foo dbname=baz");
pg_close($dba);
# $dbb is still open
and
$dba = pg_connect("user=foo pass=bar dbname=baz");
$dbb = pg_connect("user=foo pass=bar dbname=baz ");
pg_close($dba);
# $dbb is still open
The bug doesn't require that the handle be closed explicitly; I discovered it here where one of
our programmers was having connections close when one fell out of scope.
I tried moving back to PHP 4.0.2 but the bug's there too (so it doesn't look to be a
regression problem); on the other hand, a DEC Alpha running Digital Unix 4.0e and PHP 4.0.2 does
*not* exhibit this behaviour.
If you're unable to duplicate it, please get in touch with me, and I'll see if I can make
arrangements for a testing environment. I'll poke through the code myself for something
obvious, but I'm unfamiliar with PHP internals in the first place (up to now, at least).
---------------------------------------------------------------------------
Full Bug description available at: http://bugs.php.net/?id=9746