Bug #77830 [Asn->Fbk]: pg_pconnect() return new link

From: Date: Wed, 09 Jun 2021 13:36:10 +0000
Subject: Bug #77830 [Asn->Fbk]: pg_pconnect() return new link
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-234287@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=77830&edit=1

 ID:                 77830
 Updated by:         cmb@php.net
 Reported by:        yohgaki@php.net
 Summary:            pg_pconnect() return new link
-Status:             Assigned
+Status:             Feedback
 Type:               Bug
 Package:            PostgreSQL related
 PHP Version:        master-Git-2019-04-01 (Git)
-Assigned To:        yohgaki
+Assigned To:        cmb
 Block user comment: N
 Private report:     N

 New Comment:

The first call to pg_pconnect() registers a new persistent
resource, and returns it, the second call to pg_pconnect()
registers a new *non* persistent resource which wraps the same
PGconn and returns that.

While the implementation is somewhat surprising for me too, this
doesn't look like a bug to me; even the docs are not violated:

| If a second call is made to pg_pconnect() with the same
| connection_string as an existing connection, the existing
| connection will be returned […]

And odbc_pconnect() is basically implemented like that.  Why do
you regard this as bug?


Previous Comments:
------------------------------------------------------------------------
[2019-04-01 06:55:00] yohgaki@php.net

It seems it's broken for a long time. Fix this for only PHP 7.4 and later?

------------------------------------------------------------------------
[2019-04-01 06:49:43] yohgaki@php.net

Description:
------------
As stated in summary, pg_pconnect() returns new link.



Test script:
---------------
[yohgaki@dev PHP-master]$ ./sapi/cli/php -v
PHP 8.0.0-dev (cli) (built: Apr  1 2019 15:45:39) ( NTS DEBUG )
Copyright (c) The PHP Group
Zend Engine v4.0.0-dev, Copyright (c) Zend Technologies
    with Zend OPcache v8.0.0-dev, Copyright (c), by Zend Technologies
[yohgaki@dev PHP-master]$ ./sapi/cli/php -a
Interactive shell

php > $db = pg_pconnect('host=localhost');
php > var_dump($db);
resource(1) of type (pgsql link persistent)
php > $db = pg_pconnect('host=localhost');
php > var_dump($db);
resource(2) of type (pgsql link persistent)
php > 

[yohgaki@dev PHP-master]$ ./sapi/cli/php -i | grep ^pgsql
pgsql
pgsql.allow_persistent => On => On
pgsql.auto_reset_persistent => Off => Off
pgsql.ignore_notice => Off => Off
pgsql.log_notice => Off => Off
pgsql.max_links => Unlimited => Unlimited
pgsql.max_persistent => Unlimited => Unlimited




------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=77830&edit=1


Thread (4 messages)

« previous php.bugs (#234287) next »