Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:10066 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 73337 invoked by uid 1010); 24 May 2004 14:24:38 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 73267 invoked from network); 24 May 2004 14:24:38 -0000 Received: from unknown (HELO miranda.org) (209.58.150.153) by pb1.pair.com with SMTP; 24 May 2004 14:24:38 -0000 Received: (qmail 17676 invoked by uid 546); 24 May 2004 14:24:37 -0000 Received: from localhost (sendmail-bs@127.0.0.1) by localhost with SMTP; 24 May 2004 14:24:37 -0000 Date: Mon, 24 May 2004 10:24:37 -0400 (EDT) X-X-Sender: adam@miranda.org To: Christian Schneider cc: Jason Garber , internals@lists.php.net In-Reply-To: <40B1EAD7.1020800@cschneid.com> Message-ID: References: <5.1.0.14.0.20040523174015.02197460@mail.ionzoft.com> <40B1EAD7.1020800@cschneid.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Subject: Re: [PHP-DEV] Re: Destructors From: adam@trachtenberg.com (Adam Maccabee Trachtenberg) On Mon, 24 May 2004, Christian Schneider wrote: > Jason Garber wrote: > > Based on the above example, the $oSession->__destruct() method relies on > > the $oDB object still being usable. How can this be structured to > > ensure that the DB object does not get released first? It can't. > Adding something like $oSession->db = $oDB; should work in my opinion. > Didn't test it and I have no real experience with destructors. That's not guaranteed to work. PHP 5 does not guarantee that object destructors will be called in any particular order or that the order will remain constant from one invocation to another. Before asking for changes to this behavior, please check the mailing list archives for a long discussion on the topic. :) -adam -- adam@trachtenberg.com author of o'reilly's php cookbook avoid the holiday rush, buy your copy today!