Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:68945 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 28798 invoked from network); 7 Sep 2013 16:08:50 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 7 Sep 2013 16:08:50 -0000 X-Host-Fingerprint: 213.205.240.135 unknown Received: from [213.205.240.135] ([213.205.240.135:11854] helo=localhost.localdomain) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 6E/89-00660-19F4B225 for ; Sat, 07 Sep 2013 12:08:49 -0400 To: internals@lists.php.net,Levi Morrison Message-ID: <522B4F8D.2040107@mjburgess.co.uk> Date: Sat, 07 Sep 2013 17:08:45 +0100 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:17.0) Gecko/20130801 Thunderbird/17.0.8 MIME-Version: 1.0 References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Posted-By: 213.205.240.135 Subject: Re: [PHP-DEV] [RFC] Escaping RFC for PHP Core - Updates? From: michael@mjburgess.co.uk (Michael John Burgess) On 07/09/2013 15:41, Levi Morrison wrote: >> It looks nicer than Escaper::escapeJs(), Escaper::escapeHtml(), etc. >> >> Any comments? > > > Please, don't go down this route. You do not want one class to escape all > kinds of data; delegate each type of escaping to its own class: > > JavaScriptEscaper->escape(); > PhpEscaper->escape(); > HtmlEscaper->escape(); > HtmlAttributeEscaper->escape(); > > I should not have to defend this but I am willing to explain in more detail > if someone would like me to. > There doesnt need to be any object-oriented version for this problem. It's a series of pure functions. Wraping them in one or more classes adds nothing. Michael