Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:91802 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 60445 invoked from network); 21 Mar 2016 05:53:32 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 21 Mar 2016 05:53:32 -0000 Authentication-Results: pb1.pair.com header.from=daniel@ifixit.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=daniel@ifixit.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain ifixit.com designates 173.203.6.139 as permitted sender) X-PHP-List-Original-Sender: daniel@ifixit.com X-Host-Fingerprint: 173.203.6.139 smtp139.ord.emailsrvr.com Linux 2.6 Received: from [173.203.6.139] ([173.203.6.139:39391] helo=smtp139.ord.emailsrvr.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 71/10-58932-B5C8FE65 for ; Mon, 21 Mar 2016 00:53:31 -0500 Received: from smtp30.relay.ord1a.emailsrvr.com (localhost.localdomain [127.0.0.1]) by smtp30.relay.ord1a.emailsrvr.com (SMTP Server) with ESMTP id 0EA192800FC for ; Mon, 21 Mar 2016 01:53:29 -0400 (EDT) X-Auth-ID: daniel@ifixit.com Received: by smtp30.relay.ord1a.emailsrvr.com (Authenticated sender: daniel-AT-ifixit.com) with ESMTPSA id ACC65280107 for ; Mon, 21 Mar 2016 01:53:28 -0400 (EDT) X-Sender-Id: daniel@ifixit.com Received: from mail-lb0-f169.google.com (mail-lb0-f169.google.com [209.85.217.169]) (using TLSv1.2 with cipher AES128-GCM-SHA256) by 0.0.0.0:587 (trex/5.5.4); Mon, 21 Mar 2016 01:53:29 -0400 Received: by mail-lb0-f169.google.com with SMTP id qe11so65880701lbc.3 for ; Sun, 20 Mar 2016 22:53:28 -0700 (PDT) X-Gm-Message-State: AD7BkJIOLSjHIzBdnofiI9DH2xAghcirejhq2nJGYLKt93TTPRbHckEWt4I0gQiH4dL1W/K6tFU476b84oIkQw== X-Received: by 10.112.26.175 with SMTP id m15mr10347917lbg.118.1458539607115; Sun, 20 Mar 2016 22:53:27 -0700 (PDT) MIME-Version: 1.0 Received: by 10.25.16.201 with HTTP; Sun, 20 Mar 2016 22:53:07 -0700 (PDT) In-Reply-To: References: Date: Sun, 20 Mar 2016 22:53:07 -0700 X-Gmail-Original-Message-ID: Message-ID: To: Sara Golemon Cc: PHP internals Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] RFC about automatic template escaping From: daniel@ifixit.com (Daniel Beardsley) > > T_ECHO (echo, > ZEND_AST_ECHO_ESCAPE node in the syntax tree. > > > Interesting approach, I assume an explicit `echo $foo;` takes the > normal ZEND_ECHO route then? No, looking at the code and tests: echo, print, and > Which allows instances of `HtmlString` to pass straight through a > > template without being modified (skipping the html_entities call). > > > IME once you provide an escape hatch, said hatch WILL be used. It's > not a question of IF. For sure, mistakes can be made with any system, but this helps dangerous code look *more* wrong: new HtmlString($username) is obviously wrong. And it makes the correct things require little to no extra code: is always safe. > For my part, I'd toss the idea of XHP ( > https://docs.hhvm.com/hack/XHP/introduction ) back into consideration > over something like this. XHP is pretty sweet, but I imagine there are a decent number of people that don't consider using it because it is such a departure from traditional templating. > This approach has the smell of magic quotes which we got rid of for > very good reason. XHP is much more explicit in separating markup from > data and relies far less (not at all when you do it right) on escape > hatches. Huh, I don't see similarities to magic quotes at all. That had to do with attempting to sanitize input data (plenty of problems with that). All templating systems have a means of making the default output mechanism perform escaping and a means of preventing that escaping with, this adds the same for php templates. > > -Sara