Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:69370 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 86197 invoked from network); 27 Sep 2013 01:00:06 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 27 Sep 2013 01:00:06 -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.215.45 as permitted sender) X-PHP-List-Original-Sender: yohgaki@gmail.com X-Host-Fingerprint: 209.85.215.45 mail-la0-f45.google.com Received: from [209.85.215.45] ([209.85.215.45:48667] helo=mail-la0-f45.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id AE/B9-37010-298D4425 for ; Thu, 26 Sep 2013 21:00:06 -0400 Received: by mail-la0-f45.google.com with SMTP id eh20so1614643lab.32 for ; Thu, 26 Sep 2013 17:59:59 -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=ArPQ1mJGgEyfO1DCp/7jXOY5YpVaKufASEtynBQhk8s=; b=KMpDNFHyqUjW7C7zNNZi9qeyheqJB9LHMMv/T/dKQxyE69iKPQ9izhazxs6/mD+qke TqS+FbwDXI0T0XDT24+O74/BAbFC8Wcgn9ezLS5AastygP6RzDbvlMpbLvh5gkHDVmUW CnNQktLDpHmfU1+R9saVABKwobIuYuXC62l5Y7UgaZgbOB2NkfkFwVXeQxWJ1NfdyZol 7HDYuapj/cfhR7XeLk+cfx+iEW5gEeo4lcjvyu2SPa+a/qFsDaM31QIsbIG9nYPdfRj4 8GxeuWKSJ0HHkEzj3RKXdaAwZfQPE9wmiO2whgtNQG22H3kCIha0gfWIWBZDvBASJjoY c3+w== X-Received: by 10.112.52.225 with SMTP id w1mr4189210lbo.31.1380243599591; Thu, 26 Sep 2013 17:59:59 -0700 (PDT) MIME-Version: 1.0 Sender: yohgaki@gmail.com Received: by 10.112.154.201 with HTTP; Thu, 26 Sep 2013 17:59:19 -0700 (PDT) In-Reply-To: References: <522B4F8D.2040107@mjburgess.co.uk> Date: Fri, 27 Sep 2013 09:59:19 +0900 X-Google-Sender-Auth: V4O9nQomCIppL9hy5DiGeLAJdOw Message-ID: To: Levi Morrison Cc: Nikita Nefedov , internals , Michael John Burgess Content-Type: multipart/alternative; boundary=001a11c3fe90750fd904e7530125 Subject: Re: [PHP-DEV] [RFC] Escaping RFC for PHP Core - Updates? From: yohgaki@ohgaki.net (Yasuo Ohgaki) --001a11c3fe90750fd904e7530125 Content-Type: text/plain; charset=UTF-8 Hi, On Sun, Sep 8, 2013 at 1:43 AM, Levi Morrison 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 --001a11c3fe90750fd904e7530125--