Re: Re: Destructors

From: Date: Mon, 24 May 2004 14:24:37 +0000
Subject: Re: Re: Destructors
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-10066@lists.php.net to get a copy of this message
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!

« previous php.internals (#10066) next »