|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2004-06-04 15:49 UTC] iliaa@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 30 22:00:01 2025 UTC |
Description: ------------ In php_mysql.c: /* {{{ php_mysql_set_default_link */ static void php_mysql_set_default_link(int id TSRMLS_DC) { MySG(default_link) = id; zend_list_addref(id); } /* }}} */ if MySG(default_link) is already set (!= -1), the above code needs to deref it before setting the default_link. Otherwise a mysql_close down the road on the original default_link will not actually close the connection (it has too many references now). Reproduce code: --------------- A possible patch: --- php-4.3.6.orig/ext/mysql/php_mysql.c 2004-06-03 16:08:29.124642476 -0500 +++ php-4.3.6/ext/mysql/php_mysql.c 2004-06-03 16:13:21.192405843 -0500 @@ -259,6 +259,9 @@ */ static void php_mysql_set_default_link(int id TSRMLS_DC) { + if (MySG(default_link)!=-1) { + zend_list_delete(MySG(default_link)); + } MySG(default_link) = id; zend_list_addref(id); }