Re: destructor not getting called.

From: Date: Sat, 08 Sep 2001 16:52:56 +0000
Subject: Re: destructor not getting called.
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-308@lists.php.net to get a copy of this message
Matt Giddings wrote: > > register_shutdown_function("_PEAR_call_destructors"); is located at the end > of PEAR.php and based on the code, when php shuts down it should call > _PEAR_call_destructors. Since the class "filecontainer" is an extention of > "PEAR", _filecontainer is supposed to be registered as a destructor based on > the call to $this->PEAR() in filcontainer's constructor. So, correct me if > I'm wrong, but the way I see it is like this. PHP shuts down -> > _PEAR_call_destructors is called -> _filecontainer is called. This doesn't > appear to be happening. Any ideas why it wouldn't. Are there any > configuration switches that need to be set inorder to allow this to work? > You are right. To register a destructor: class Foo extends PEAR { // constructor function Foo() { $this->PEAR(); } // destructor function _Foo() { // code to be executed when the // script ends } } Please note that _Foo() is called under register_shutdown_function() so no "echo" or "print" statement will be output if you are not using the php script mode (ie. as apache module). So perhaps your problem is there. Tomas V.V.Cox

« previous php.pear.general (#308) next »