Skip to content

Commit 971e6e4

Browse files
committed
trying possible fix on master
1 parent 2ca38d1 commit 971e6e4

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

ext/pgsql/pgsql.c

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -589,15 +589,18 @@ static void php_pgsql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
589589
PGG(num_links)++;
590590
PGG(num_persistent)++;
591591
} else { /* we do */
592-
if ((connect_type & PGSQL_CONNECT_FORCE_NEW)) {
593-
if (zend_hash_del(&EG(persistent_list), str.s) != SUCCESS) {
594-
goto err;
595-
}
596-
goto newpconn;
597-
}
598592
if (le->type != le_plink) {
599593
goto err;
600594
}
595+
if ((connect_type & PGSQL_CONNECT_FORCE_NEW)) {
596+
PGresult *res;
597+
pgsql = (PGconn *) le->ptr;
598+
PQfinish(pgsql);
599+
PGG(num_links)--;
600+
PGG(num_persistent)--;
601+
le->ptr = NULL;
602+
goto newpconn;
603+
}
601604
/* ensure that the link did not die */
602605
if (PGG(auto_reset_persistent) & 1) {
603606
/* need to send & get something from backend to

0 commit comments

Comments
 (0)