Re: [RFC] New operator for context-dependent escaping
| From: | Dan Ackroyd | Date: | Sat, 16 Jul 2016 20:24:49 +0000 |
| Subject: | Re: [RFC] New operator for context-dependent escaping | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-94522@lists.php.net to get a copy of this message | ||
Hi Michael,
On 16 July 2016 at 16:33, Michael Vostrikov <michael.vostrikov@gmail.com> wrote:
> Hello.
> I have created RFC about context-dependent escaping operator.
> https://wiki.php.net/rfc/escaping_operator
>
> Initial discussion was here:
> http://marc.info/?t=146619199100001
I'm more than slightly sceptical about this RFC's chances, but to give
you some feedback, this bit is a bad pattern:
> bool PHPEscaper::registerHandler(string $context, callable $escaper_function)
>
> Registers new handler for a given context. If handler for this context is already
> registered, it returns false, on success registration returns true.
It would be better to return the previous handler, or NULL if one
wasn't set, in the same way as set_error_handler() does, and for the
same reasons.
Also, shouldn't these just be functions? Why is there a class involved
when it only has static functions/state?
cheers
Dan