Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:53453 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 11360 invoked from network); 20 Jun 2011 21:41:47 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Jun 2011 21:41:47 -0000 Authentication-Results: pb1.pair.com smtp.mail=arraypad@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=arraypad@gmail.com; sender-id=pass; domainkeys=bad Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.212.42 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: arraypad@gmail.com X-Host-Fingerprint: 209.85.212.42 mail-vw0-f42.google.com Received: from [209.85.212.42] ([209.85.212.42:43120] helo=mail-vw0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 3E/24-22948-99EBFFD4 for ; Mon, 20 Jun 2011 17:41:46 -0400 Received: by vwl1 with SMTP id 1so1564514vwl.29 for ; Mon, 20 Jun 2011 14:41:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=7QZij6oVoz65FdP9fYc+WduxQyJpr7/zcZAjowSPrBY=; b=etvLQRPtwee1BJiYG31pWajY+BrJzQnL5JNAaPZXZ5DZqgTsYSMYzsPk2o5tnhYB9t 0CdRF47RZG7GGj9pCZI+CnwY5YaQrqhOGxj5wHqkFVTFl6j/cByYZSMN6ZPHxArWkihw hpvC9QArGOC4XzKvFWT5L3QXfqqfpwSBgm5jU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=xP5NFq5mE68lyld7jQKDkTCc+y5rElGidyLmyH6BhDTJpbEAanrERTC+XptbBn9gqM XaFWc1Kilf/X2//XWBRFN0/yFElZW7twGcJlvWJTXQFXoKA7UKm0xTmPx7UHGCXyS5Pm yc7/yW9szuhSPV33a0D097yxs5WhgekmzUms8= MIME-Version: 1.0 Received: by 10.52.115.6 with SMTP id jk6mr258177vdb.188.1308606102330; Mon, 20 Jun 2011 14:41:42 -0700 (PDT) Received: by 10.52.182.39 with HTTP; Mon, 20 Jun 2011 14:41:42 -0700 (PDT) In-Reply-To: <00df75ce7b1c7095eecfcd9f419908c6@localhost> References: <1308569847.3172.18.camel@guybrush> <00df75ce7b1c7095eecfcd9f419908c6@localhost> Date: Mon, 20 Jun 2011 22:41:42 +0100 Message-ID: To: =?ISO-8859-1?Q?Johannes_Schl=FCter?= Cc: internals@lists.php.net Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] [PATCH] unregister_shutdown_function() From: arraypad@gmail.com (Arpad Ray) 2011/6/20 Johannes Schl=FCter : > > (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 wrote: >> 2011/6/20 Johannes Schl=FCter : >>> 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: >>> >>> =A0 =A0$a =3D function() {}; >>> =A0 =A0register_shutdown_function($a); >>> =A0 =A0unregister_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 >>> >>> =A0 =A0get_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