Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:10753 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 28805 invoked by uid 1010); 24 Jun 2004 11:29:36 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 28760 invoked from network); 24 Jun 2004 11:29:36 -0000 Received: from unknown (HELO stack.fission.org.uk) (195.82.120.217) by pb1.pair.com with SMTP; 24 Jun 2004 11:29:36 -0000 Received: from gaz by stack.fission.org.uk with local (Exim 3.36 #1 (Debian)) id 1BdSOA-0003wE-00 for ; Thu, 24 Jun 2004 12:27:30 +0100 Date: Thu, 24 Jun 2004 12:27:30 +0100 To: internals@lists.php.net Message-ID: <20040624112730.GA14349@snipe.visualcode.co.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.5.1+cvs20040105i Subject: __Destruct() functionality From: gaz@stack.fission.org.uk (Gareth Ardron) ok, If this is fixed in cvs, I appologise - google wasn't suggesting that this has come up before. I've just been playing around with the __destruct() function a little bit, and seeing exactly what I could do with it. Basically, I have a company info class, and a logger class. The logger class is loaded and called by the main script first, with the object accessed through $LOG. It's only very basic $log->event(""); type functions though. Now, this $LOG is then passed to the company info class when that is initialised (the way it's set up, I'm deliberatly avoiding extending classes for this). From this point, companyInfo class takes the $LOG variable passed to it in the __construct() method and assigns it to a private variable within the class. What I'm then trying to do within the __destruct() method is to then do: if ($this->LOG->events) { $this->LOG->event("Leaving company info class"); } However, what seems to be happening is that this is not being executed, presumably as the variables/objects have been removed from memory before __destruct() is called. I'm also getting no warning whatsoever. It'd seem to me, that the ability to call variables within __destruct() is quite valuable, as you're kinda limited to just printing output otherwise (ok, not strictly true, but you get what I mean). This is with php5-rc3 btw. Can anybody confirm that this is 'intended' behaviour - because it seems bloody odd if it is. Cheers. -- Gareth Ardron