|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #77830 pg_pconnect() return new link
Submitted: 2019-04-01 06:49 UTC Modified: 2021-06-20 04:22 UTC
From: Assigned: cmb (profile)
Status: No Feedback Package: PostgreSQL related
PHP Version: master-Git-2019-04-01 (Git) OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
Solve the problem:
28 + 7 = ?
Subscribe to this entry?

 [2019-04-01 06:49 UTC]
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.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


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2019-04-01 06:49 UTC]
-Assigned To: +Assigned To: yohgaki
 [2019-04-01 06:55 UTC]
It seems it's broken for a long time. Fix this for only PHP 7.4 and later?
 [2021-06-09 13:36 UTC]
-Status: Assigned +Status: Feedback -Assigned To: yohgaki +Assigned To: cmb
 [2021-06-09 13:36 UTC]
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?
 [2021-06-20 04:22 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Mon Sep 20 05:03:36 2021 UTC