Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:91804 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 65391 invoked from network); 21 Mar 2016 06:20:54 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 21 Mar 2016 06:20:54 -0000 Authentication-Results: pb1.pair.com header.from=pierre.php@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=pierre.php@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.214.170 as permitted sender) X-PHP-List-Original-Sender: pierre.php@gmail.com X-Host-Fingerprint: 209.85.214.170 mail-ob0-f170.google.com Received: from [209.85.214.170] ([209.85.214.170:33186] helo=mail-ob0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 5D/01-58932-5C29FE65 for ; Mon, 21 Mar 2016 01:20:54 -0500 Received: by mail-ob0-f170.google.com with SMTP id fz5so22617584obc.0 for ; Sun, 20 Mar 2016 23:20:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc; bh=ypjudq/VoMlGHSuHY1Gv0U9TqHOn0nh/LfEZSj9sLqM=; b=bqF+1neOGTYVmzSIX1gu9p0IBNvICtLwRSheiK2QSgkenyS0OL0pcdtSbzv0h5rJ3r UyDSJJIz8w5wT7uVRukHAVcIHe507zgIREaCvSXnXCJIwNpt8AMLq6qL3k3mGJbhu+1x a2eBDdmC15hsHsmhoO7Gp8d7XmUsbfObW7e37bJdQWCVqWlwZFYAwmZZBLr55tAclSwm r8mHg0KfBY0DZ9a5BnmDpUIO95AuKKBPyuPoEyaNgp00IPP0WCENApbhWzPILGxmtlbP IZOV2YDA+H1sCIRPY1W9ybmKykbLvD/YHaAcy0m7YYUItbVfUOQ4RoncPY/77Mm9ol+K RuBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc; bh=ypjudq/VoMlGHSuHY1Gv0U9TqHOn0nh/LfEZSj9sLqM=; b=IV5HO/NSpWB9xxb7GJx/pVe+cyZHSQeExgj9t0a7bIENzg3LnTrPG5quq4cjJVW4Gy U3FMGO5hI+KhH1r52mCvzYnniBWP8BG0H/K/FdSmS6iPmQGoXKErjL5wxeFqfgGyTK5Z G8T97166dSvaC7RPXpyM1qn84zgS0MB1JR6EY88C8Cv3PuO9Kfb+FRYJD8vK58alBJoA DKynbnD6evvdVXCFdBKlRfSVG2YItN/e1ONxyAoOiGZxwhGNUtM6TdWrYWvpF3E3+x+Q rHQ9CYodrHen/Qt30Q+74Xz12AscEuj07WdNDqB/VTMDOu+dS+aYtMDh644toJKMIS/n xx2A== X-Gm-Message-State: AD7BkJL073LoWTQ153GJIwqEZ6H3FZo69BvMScQWN7ujKWbHssdbtllwb1nILYIANwhuY9v6sOoK0H9AAPC0rg== MIME-Version: 1.0 X-Received: by 10.60.119.39 with SMTP id kr7mr16297511oeb.34.1458541250599; Sun, 20 Mar 2016 23:20:50 -0700 (PDT) Received: by 10.202.215.193 with HTTP; Sun, 20 Mar 2016 23:20:49 -0700 (PDT) Received: by 10.202.215.193 with HTTP; Sun, 20 Mar 2016 23:20:49 -0700 (PDT) In-Reply-To: References: Date: Mon, 21 Mar 2016 13:20:49 +0700 Message-ID: To: Daniel Beardsley Cc: PHP internals , Sara Golemon Content-Type: multipart/alternative; boundary=047d7b33d03421e31a052e8919d8 Subject: Re: [PHP-DEV] RFC about automatic template escaping From: pierre.php@gmail.com (Pierre Joye) --047d7b33d03421e31a052e8919d8 Content-Type: text/plain; charset=UTF-8 On Mar 21, 2016 12:53 PM, "Daniel Beardsley" wrote: > > > > 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 parsing to a ZEND_AST_ECHO_ESCAPE which emits a > ZEND_ECHO_ESCAPE op code when compiled. Only inline > html still compiles as ZEND_ECHO. > > > > 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. Not the default (php) output but their default behavior when no specific escape method (or filter/whatever else) has not been specified. This is a huge difference with is proposed here. Not sure about having such features in the core. It does sound like trying to solve a real issue but using the wrong solution or in the wrong place. Cheers, Pierre --047d7b33d03421e31a052e8919d8--