Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:4499 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 5768 invoked by uid 1010); 16 Sep 2003 16:05:39 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 5595 invoked from network); 16 Sep 2003 16:05:38 -0000 Received: from unknown (HELO mail.zend.com) (192.117.235.230) by pb1.pair.com with SMTP; 16 Sep 2003 16:05:38 -0000 Received: (qmail 11103 invoked from network); 16 Sep 2003 16:05:36 -0000 Received: from localhost (HELO zeev-laptop.zend.com) (127.0.0.1) by localhost with SMTP; 16 Sep 2003 16:05:36 -0000 Reply-To: zeev@zend.com Message-ID: <5.1.0.14.2.20030916190715.04a0eeb0@localhost> X-Sender: zeev@localhost X-Mailer: QUALCOMM Windows Eudora Version 5.1 Date: Tue, 16 Sep 2003 19:09:20 +0300 To: Georg Richter Cc: internals@lists.php.net In-Reply-To: <200309132116.45988.georg@php.net> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed Subject: Re: [PHP-DEV] Bug in xxxxx_close(); From: zeev@zend.com (Zeev Suraski) References: <200309132116.45988.georg@php.net> At 22:16 13/09/2003, Georg Richter wrote: >Hi, > >currently I don't have time to analyze or fix it, so I hope someone will take >a look, it affects most of db-extensions which support (optional) default >connection. > >Sample: > > for ($i=0;$i<1000; $i++) { > $link = mysql_connect("localhost", "foo", "bar"); > mysql_close(); > } >?> > >doesn't work correct: > >Function _close_mysql_link which was registered via >zend_register_list_destructors_ex will be called only 1 time at end of >script. If you specify mysql_close($link) instead, everything works fine. It's actually by-design(tm). mysql_close() will close the default link, but $link still holds it open. Every subsequent call to mysql_connect() will reuse this already opened link. If you explicitly use mysql_close($link), or otherwise get rid of $link (like unsetting it) - it should work. Zeev