Re: __Destruct() functionality
| From: | Florian Schaper | Date: | Mon, 28 Jun 2004 11:25:15 +0000 |
| Subject: | Re: __Destruct() functionality | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-10817@lists.php.net to get a copy of this message | ||
Marcus Boerger wrote:
> Hello Gareth,
>
> __destruct will get executed during request shutdown after the
> communication has been shutdown. The only way to be able to write
> from within __destruct is to deinitialize it at the end of the
> script and therefore before the request is being finished. To
> do so you can use 'unset($object);'
>
But then again why call destruct on the objects after the external
modules
have been shut down? This heavily confuses people and I see no apparent
reason
to do so (then again I'm not deep into the PHP internal structure)?
I find it highly attractive to be able to save a "session"-object via my
destructor / close DB connections - you name it.
zend_objects_store_call_destructors(&EG(objects_store) TSRMLS_CC);
before php_call_shutdown_functions(); etc.
Can somebody enlighten me?
./regards
Florian