Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:41330 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 92608 invoked from network); 23 Oct 2008 04:09:45 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 23 Oct 2008 04:09:45 -0000 Authentication-Results: pb1.pair.com smtp.mail=evertpot@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=evertpot@gmail.com; sender-id=pass; domainkeys=bad Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.217.14 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: evertpot@gmail.com X-Host-Fingerprint: 209.85.217.14 mail-gx0-f14.google.com Received: from [209.85.217.14] ([209.85.217.14:59589] helo=mail-gx0-f14.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 8D/71-41302-709FFF84 for ; Thu, 23 Oct 2008 00:09:44 -0400 Received: by gxk7 with SMTP id 7so624200gxk.23 for ; Wed, 22 Oct 2008 21:09:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:cc:message-id:from:to :in-reply-to:content-type:content-transfer-encoding:mime-version :subject:date:references:x-mailer:sender; bh=WYzIRTAISWtGM8loCXDEFhTv/uzGFSMroGdXPk3sNjw=; b=XZ8yz6wiS/6wLSsROG59HnkHatTG8jb5trrcxIIR7+5HVC2i71WhjMSw7SfbiYFSWL Qpo/fJ4o2i28JfuaSXIoNtAbgrjob79KXMHDnzF3EG6189hni+uo1cLcbvRv+uBa/Qy1 ekATZcZ59l6ArbzyZpdadqbVI9cJHRyEBU1GA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=cc:message-id:from:to:in-reply-to:content-type :content-transfer-encoding:mime-version:subject:date:references :x-mailer:sender; b=dkn2/KjudUPXqhIidAf/7nnIC82BgA+HnVdgmqRaQJWaVr6MHtoDaYbqaeGS9bo7sJ suW8JzlXd0MoyoZ40I13dnmTzWvH1crpMf5o2skhcSiZDaBqMbD5ET2rGqnvsq+HW5BY Xo5vQ/xxAkSpXEKhIwRjZdkbmBQeBxyR/QLko= Received: by 10.65.160.7 with SMTP id m7mr124013qbo.16.1224734980287; Wed, 22 Oct 2008 21:09:40 -0700 (PDT) Received: from ?192.168.0.112? (CPE001cf05d461e-CM0018689934a4.cpe.net.cable.rogers.com [99.254.59.165]) by mx.google.com with ESMTPS id k27sm11170899qba.10.2008.10.22.21.09.38 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 22 Oct 2008 21:09:39 -0700 (PDT) Cc: internals@lists.php.net Message-ID: <70F4E63C-CA1A-4811-ADE9-F322C467926F@filemobile.com> To: Larry Garfield In-Reply-To: <200810222123.58206.larry@garfieldtech.com> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v929.2) Date: Thu, 23 Oct 2008 00:09:35 -0400 References: <48FED6DA.2090400@naenius.com> <200810222123.58206.larry@garfieldtech.com> X-Mailer: Apple Mail (2.929.2) Sender: Evert Pot - Rooftop Solutions Subject: Re: [PHP-DEV] Destructor Order From: evert@filemobile.com (Evert | Filemobile) > 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. If you want to treat a PHP script as a traditional application, you should be prepared to unset() and keep references of everything yourself. Relying on the garbage collector for your business logic to work is just bad design. I'd personally always explicitly do a ->saveObject in similar situations as its predictable and quite frankly never found a use for a destructor other than debugging.. Sounds like a subject that doesn't belong on PHP-DEV in any event. Evert