Re: [PATCH] unregister_shutdown_function()
| From: | Johannes Schlüter | Date: | Mon, 20 Jun 2011 11:37:27 +0000 |
| Subject: | Re: [PATCH] unregister_shutdown_function() | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-53386@lists.php.net to get a copy of this message | ||
On Mon, 2011-06-20 at 07:36 +0100, Arpad Ray wrote:
> This patch implements unregister_shutdown_function(), which removes a
> function already registered with register_shutdown_function().
>
> It resolves request #53702 (according to google, not sure if it's
> still active) and I've thought it a curious absence for a while.
Why do you register a shutdown function if you want to remove it again?
Shouldn't you fix the architecture of your code instead of relying on
such functions?
> The patch (against trunk) is at:
>
> http://spellign.com/patches/php-trunk-unregister_shutdown_function.patch
Does register_shutdown_function() work with closures? (Didn't test it)
Then the following should work, too, which isn't the case in your code:
$a = function() {};
register_shutdown_function($a);
unregister_shutdown_function($a);
I also think once that functionality is there the next request will be
get_registered_shutdown_functions()
or something along the lines.
johannes