summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJouni Ahto <jah@php.net>2000-07-05 22:17:30 +0000
committerJouni Ahto <jah@php.net>2000-07-05 22:17:30 +0000
commit344955d0206520fb2fef566745caaccbf83935d5 (patch)
tree4768f8e396f48bdf9ead7812eed8c8971f04f9d9
parentbcb7639fb3cd87afcc580dd6230fcd7b8786f2b4 (diff)
downloadphp-git-344955d0206520fb2fef566745caaccbf83935d5.tar.gz
- Still one misssing zend_list_addref() and small fix in pg_close.
Fixes #5349 (but not the way reporter wants...). # There's something in the way database_connect/close functions behave when # implemented the way as in mysql module that I find a bit strange... because # of that extra zend_list_addref() there to prevent default link disappearing # if it's not assigned to variable, when it is, I guess its' reference count # is at this point 2, I can do: open a db link and assign it to a variable, # close the link and still use it afterwards.
-rw-r--r--ext/pgsql/pgsql.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/ext/pgsql/pgsql.c b/ext/pgsql/pgsql.c
index b25f983786..ecf867e367 100644
--- a/ext/pgsql/pgsql.c
+++ b/ext/pgsql/pgsql.c
@@ -370,6 +370,7 @@ void php_pgsql_do_connect(INTERNAL_FUNCTION_PARAMETERS,int persistent)
if (ptr && (type==le_link || type==le_plink)) {
return_value->value.lval = PGG(default_link) = link;
return_value->type = IS_RESOURCE;
+ zend_list_addref(link);
efree(hashed_details);
return;
} else {
@@ -462,7 +463,7 @@ PHP_FUNCTION(pg_close)
}
ZEND_FETCH_RESOURCE2(pgsql, PGconn *, pgsql_link, id, "PostgreSQL link", le_link, le_plink);
- zend_list_delete(Z_LVAL_PP(pgsql_link));
+ zend_list_delete(id);
RETURN_TRUE;
}
/* }}} */