On Sat, 31 Jul 2004, Paul G wrote:
> actually, alloc/dealloc was just used as an example. it could be anything -
> rollback, closing sockets, pretty much any sort of 'undoing' that you need
> to do to make it look like nothing ever happened ;) what you are suggesting
> is similar to the hack i'm using now and referred to in an earlier mail, ie
> registering thingers to be 'undone'. while useful for certain things, it's
> too verbose for the majority of situations When Done Here(tm).

You pretty much have to use a shutdown function for this though.  By
default a PHP script will terminate if the listener goes away.  That is,
if someone starts loading the page and hits Stop or shuts down their
browser before you have written all your output, your script is
terminated as soon as it detects this so it is unlikely to ever run your
cleanup code in that case.  You need to register_shutdown_function() if
you have a critical cleanup thing that must be run, or you need to force
ignore_user_abort on in your config or at the beginning of your script to
make sure you are not aborted halfway through.

-Rasmus

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to