Re: register_shutdown_function() not supports private methods
| From: | Claude Pache | Date: | Wed, 27 Nov 2019 23:56:14 +0000 |
| Subject: | Re: register_shutdown_function() not supports private methods | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-107876@lists.php.net to get a copy of this message | ||
> Le 28 nov. 2019 à 00:33, David Rodrigues <david.proweb@gmail.com> a écrit :
>
> My real case is that I am initializing a static method that will register
> some shutdowns events (that are static methods too). This shutdown function
> should be private, to avoid execution at a public scope. As workaround I am
> keeping it as public.
Another workaround is to use a closure:
register_shutdown_function(function () { self::privateMethod(); });
—Claude