From 99e5dfd00eecc14f36cef86346907f2e5e9b9b07 Mon Sep 17 00:00:00 2001 From: Romolo Manfredini Date: Mon, 26 Mar 2001 08:00:43 +0000 Subject: [PATCH] pg_close was undefining default_conn even if a ref to it was still there. --- ext/pgsql/pgsql.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/ext/pgsql/pgsql.c b/ext/pgsql/pgsql.c index 748fc80bc79..7c8924e88d8 100644 --- a/ext/pgsql/pgsql.c +++ b/ext/pgsql/pgsql.c @@ -501,7 +501,8 @@ PHP_FUNCTION(pg_pconnect) PHP_FUNCTION(pg_close) { zval **pgsql_link = NULL; - int id; + void *ptr; + int id, type; PGconn *pgsql; PGLS_FETCH(); @@ -527,12 +528,15 @@ PHP_FUNCTION(pg_close) if (id==-1) { /* explicit resource number */ zend_list_delete(Z_RESVAL_PP(pgsql_link)); + ptr = zend_list_find(Z_RESVAL_PP(pgsql_link),&type); + if (ptr && (type==le_link || type==le_plink)) { + RETURN_TRUE; + } } if (id!=-1 || (pgsql_link && Z_RESVAL_PP(pgsql_link)==PGG(default_link))) { - if (id!=-1) - zend_list_delete(PGG(default_link)); + zend_list_delete(PGG(default_link)); PGG(default_link) = -1; }