Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:69369 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 84646 invoked from network); 27 Sep 2013 00:54:17 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 27 Sep 2013 00:54:17 -0000 Authentication-Results: pb1.pair.com header.from=yohgaki@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=yohgaki@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.217.178 as permitted sender) X-PHP-List-Original-Sender: yohgaki@gmail.com X-Host-Fingerprint: 209.85.217.178 mail-lb0-f178.google.com Received: from [209.85.217.178] ([209.85.217.178:34816] helo=mail-lb0-f178.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 46/69-37010-837D4425 for ; Thu, 26 Sep 2013 20:54:17 -0400 Received: by mail-lb0-f178.google.com with SMTP id z5so1713123lbh.37 for ; Thu, 26 Sep 2013 17:54:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=jyQAfx7m3NlGsl6qnWOjhM7STvrOLa2PEpZDwXDu4NY=; b=rEfIxgHE8vgwV82JhKZyT+VRjuyAJjnssEQSa87EaeNa2E3E4zy0C/hVIHKdcqXF+6 1rVTWV39E8HDTPG0whyU+V5usMJlP88gz8O9RGK/byT5yE+E4LFVq+9c9NRxYd/tz3Md m+/4kn11DYuGSoMLMDrxs/AhpOEnDjkajYWXK+j9q0vmEmGAl/n+W/o367A0nLE/5a8x uGzaqLMEhYLUwiMgTrqGWaoxo58zQSn8J8k6UnDi9ckkaFn+96y6WF6KJLg72wL7cIZ+ QxIoyqwF1DweUT8huz242RTeccXmCu2FlyyI4faHnKpm41B+t02jP9mqxNVaputsgvDG fWgw== X-Received: by 10.152.29.201 with SMTP id m9mr3154538lah.6.1380243254232; Thu, 26 Sep 2013 17:54:14 -0700 (PDT) MIME-Version: 1.0 Sender: yohgaki@gmail.com Received: by 10.112.154.201 with HTTP; Thu, 26 Sep 2013 17:53:34 -0700 (PDT) In-Reply-To: References: <522B4F8D.2040107@mjburgess.co.uk> Date: Fri, 27 Sep 2013 09:53:34 +0900 X-Google-Sender-Auth: yn2eM_uYWJteMEsHI8Oocde47LQ Message-ID: To: Nikita Nefedov Cc: "internals@lists.php.net" , Michael John Burgess Content-Type: multipart/alternative; boundary=089e0158cb92df4c1104e752ecc3 Subject: Re: [PHP-DEV] [RFC] Escaping RFC for PHP Core - Updates? From: yohgaki@ohgaki.net (Yasuo Ohgaki) --089e0158cb92df4c1104e752ecc3 Content-Type: text/plain; charset=UTF-8 Hi, On Sun, Sep 8, 2013 at 1:36 AM, Nikita Nefedov wrote: > On Sat, 07 Sep 2013 20:08:45 +0400, Michael John Burgess < > michael@mjburgess.co.uk> wrote: > > 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 >> >> > Hi, > > Wrapping those functions in methods means they can be extended in child > classes. So suppose you have some library that takes object of type > Spl_Escaper and uses its methods for escaping some data. Now if you will > need some additional escaping you just need to make child class for > Spl_Escaper and override methods which behavior you need to change. This > can't be done with pure functions (in PHP). > > I'm in favor of implementing this in ext/filter now, but extend-ability is good benefit. -- Yasuo Ohgaki yohgaki@ohgaki.net --089e0158cb92df4c1104e752ecc3--