]> granicus.if.org Git - php/commitdiff
- Still one misssing zend_list_addref() and small fix in pg_close.
authorJouni Ahto <jah@php.net>
Wed, 5 Jul 2000 22:17:30 +0000 (22:17 +0000)
committerJouni Ahto <jah@php.net>
Wed, 5 Jul 2000 22:17:30 +0000 (22:17 +0000)
  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.

ext/pgsql/pgsql.c

index b25f983786716c21d4110565504c044c1ff6a120..ecf867e3674f1d1598c358a94557b2296dea21f3 100644 (file)
@@ -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;
 }
 /* }}} */