Re: [RFC] Escaping RFC for PHP Core - Updates?

From: Date: Fri, 27 Sep 2013 00:59:19 +0000
Subject: Re: [RFC] Escaping RFC for PHP Core - Updates?
References: 1 2 3 4 5 6 7  Groups: php.internals 
Request: Send a blank email to internals+get-69370@lists.php.net to get a copy of this message
Hi, On Sun, Sep 8, 2013 at 1:43 AM, Levi Morrison <morrison.levi@gmail.com>wrote: > You have a flawed understanding of good functional design. Instead of > directly calling the escaping function you would simply ask for a callable > and pass in the escaping function. Thus, you could use an alternative > escaping function at runtime. > > The methods route is a poor choice. If we use classes at all, separate the > responsibility of each type of escaping to a separate class. Escaping JSON > and HTML code have little (possibly nothing) in common and do not belong in > the same class. > You are proposing something like $escape_function = function($input) { $output=avaScriptEscaper->escape($input); $output=do_some_additional($output); return $output; } my_escape($some_data, $escape_function) { return $escape_function($some_data); } Is this correct? Regards, -- Yasuo Ohgaki yohgaki@ohgaki.net

« previous php.internals (#69370) next »