Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:41340 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 83158 invoked from network); 23 Oct 2008 11:16:16 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 23 Oct 2008 11:16:16 -0000 Authentication-Results: pb1.pair.com smtp.mail=diogo@ead.fiocruz.br; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=diogo@ead.fiocruz.br; sender-id=unknown Received-SPF: error (pb1.pair.com: domain ead.fiocruz.br from 157.86.152.50 cause and error) X-PHP-List-Original-Sender: diogo@ead.fiocruz.br X-Host-Fingerprint: 157.86.152.50 nick.procc.fiocruz.br Linux 2.4/2.6 Received: from [157.86.152.50] ([157.86.152.50:54729] helo=nick.procc.fiocruz.br) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id C2/08-44135-EFC50094 for ; Thu, 23 Oct 2008 07:16:15 -0400 Received: from mail.ead.fiocruz.br (elza.ead.fiocruz.br [10.24.24.5]) by nick.procc.fiocruz.br (8.13.6/8.12.10) with ESMTP id m9NBFu0S027427; Thu, 23 Oct 2008 09:16:18 -0200 Received: from [157.86.205.237] (micro-205-237.ensp.fiocruz.br [157.86.205.237]) by mail.ead.fiocruz.br (Postfix) with ESMTP id 61A371CC06A; Thu, 23 Oct 2008 09:15:07 -0200 (BRST) Message-ID: <49005CB9.1070500@ead.fiocruz.br> Date: Thu, 23 Oct 2008 09:15:05 -0200 User-Agent: Thunderbird 1.5.0.14ubu (X11/20080925) MIME-Version: 1.0 To: Larry Garfield CC: internals@lists.php.net References: <48FED6DA.2090400@naenius.com> <200810222123.58206.larry@garfieldtech.com> In-Reply-To: <200810222123.58206.larry@garfieldtech.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on nick.procc.fiocruz.br X-Antivirus: checked in 0.006sec at nick.procc.fiocruz.br ([10.24.24.50]) by smf-clamd v1.2.1 - http://smfs.sf.net/ Subject: Re: [PHP-DEV] Destructor Order From: diogo@ead.fiocruz.br (=?UTF-8?B?RGlvZ28gR2FsdsOjbw==?=) "The destructor method will be called as soon as all references to a particular object are removed or when the object is explicitly destroyed or in any order in shutdown sequence." As far as I understand it if your active record references the PDO instance (say $this->conn) your object gets destroyed before the connection object. Perhaps it's a better approach then introducing destruction order for global or singleton problems. wbr, Diogo Larry Garfield wrote: > On Wednesday 22 October 2008 2:31:38 am Mike van Riel wrote: > > I believe the "end of your script" part is the problem. Imagine you have some > object (say, ActiveRecord style) that writes itself to the database when it's > destroyed if the data has been modified. Now cache that object in a static > variable somewhere for performance. You're also using PDO, so your database > connection is a global or singleton instance of the PDO class. > > Then your script reaches the end. Does your object get destroyed and > therefore saved to the database before or after the PDO object goes away? I > don't actually know. > > I'm not saying that manual destructor order is the correct way to deal with > that issue necessarily, but I think that's the sort of use case it's intended > to address. >