From: Jouni Ahto Date: Wed, 5 Jul 2000 22:17:30 +0000 (+0000) Subject: - Still one misssing zend_list_addref() and small fix in pg_close. X-Git-Tag: PRE_METHOD_CALL_SEPERATE_FIX_PATCH~11 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=344955d0206520fb2fef566745caaccbf83935d5;p=php - 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. --- 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; } /* }}} */