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
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php