summaryrefslogtreecommitdiff
path: root/ext/mysql/php_mysql.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/mysql/php_mysql.c')
-rw-r--r--ext/mysql/php_mysql.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/ext/mysql/php_mysql.c b/ext/mysql/php_mysql.c
index 94bfb6cfd2..580296a3cf 100644
--- a/ext/mysql/php_mysql.c
+++ b/ext/mysql/php_mysql.c
@@ -1125,15 +1125,15 @@ PHP_FUNCTION(mysql_close)
mysqlnd_end_psession(mysql->conn);
}
#endif
- if (!mysql_link) {
- --GC_REFCOUNT(res);
+ if (res == MySG(default_link)) {
+ zend_list_delete(res);
MySG(default_link) = NULL;
- } else if (mysql_link && Z_RES_P(mysql_link) == MySG(default_link)) {
- --GC_REFCOUNT(res);
- MySG(default_link) = NULL;
- zend_list_close(res);
- } else {
- zend_list_close(res);
+ }
+ if (mysql_link) {
+ /* we have at least 3 additional references to this resource ??? */
+ if (GC_REFCOUNT(res) <= 3) {
+ zend_list_close(res);
+ }
}
}