Re: [PATCH] unregister_shutdown_function()

From: Date: Mon, 20 Jun 2011 21:41:42 +0000
Subject: Re: [PATCH] unregister_shutdown_function()
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to internals+get-53453@lists.php.net to get a copy of this message
2011/6/20 Johannes Schlüter <johannes@schlueters.de>: > > (any reason you sent this privately?) Nope, must have hit the wrong button ;) back to the list now. > > On Mon, 20 Jun 2011 18:38:50 +0100, Arpad Ray <arraypad@gmail.com> wrote: >> 2011/6/20 Johannes Schlüter <johannes@schlueters.de>: >>> 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? >>> >> >> Hi, >> >> The use case for this function is where you don't control the >> registration of the shutdown function and you want to remove it, for >> example the framework you're using does it. > > Then fix the framework or use a better one. I'm inclined to agree, just providing an implementation. If it's not wanted, ok. > >>> 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); >>> >> >> Thanks for pointing this out, I've updated it to support closures, >> which also simplifies the patch a bit: > > Good. > >> > > http://spellign.com/patches/php-trunk-unregister_shutdown_function2.patch >> >>> I also think once that functionality is there the next request will be >>> >>>    get_registered_shutdown_functions() >>> >>> or something along the lines. >> >> I don't see of what use that could be. > > Completeness? "Has that stupid shutdown func been registered?" Fair enough, although I should point out that unregister_shutdown_function() returns false if the function hadn't been registered, so if the aim of checking whether it's registered is to remove it then that's unnecessary. Regards, Arpad

« previous php.internals (#53453) next »