Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:94155 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 48793 invoked from network); 20 Jun 2016 16:40:09 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Jun 2016 16:40:09 -0000 Authentication-Results: pb1.pair.com header.from=michael.vostrikov@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=michael.vostrikov@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.220.179 as permitted sender) X-PHP-List-Original-Sender: michael.vostrikov@gmail.com X-Host-Fingerprint: 209.85.220.179 mail-qk0-f179.google.com Received: from [209.85.220.179] ([209.85.220.179:33800] helo=mail-qk0-f179.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 8E/C4-16093-86C18675 for ; Mon, 20 Jun 2016 12:40:09 -0400 Received: by mail-qk0-f179.google.com with SMTP id t127so47691506qkf.1 for ; Mon, 20 Jun 2016 09:40:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=0mO6sSniBeqYpCHUASTuAnvCCkAjsP52GakNKXYR8JI=; b=CVvf9V7DKh1bN/rYZYNlkkqTxE+V3U+Y7u6rCjNh+GXtQIhcU4XDRHTCVzw1y1qx8o N7MfLW5BewTdpTMUy9zKSMexGgI5lu5iQLoQ78vQCpEfguVrb6rNLby+IZLmy7pkx5q1 4Jm8w/pBp+mrOjOzOt+nNHW6vMbw9LneVfEZea4hppwnMA30loGbL1Wj4QNbofOrSmvp FNTHV/1xkGv7MlUWPFA/ivn7/LWZ0vP/N28eMjjyI25SxJQPndl5Au2W3WhRdSbHW+Ve EGPJkL2oWgT0m5TZI88GPthhiPMnRHa3zl1GkS1FuduwHtoR7NCSB6Ck+fEtzYnnrhLA 3S5A== 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:from:date :message-id:subject:to:cc; bh=0mO6sSniBeqYpCHUASTuAnvCCkAjsP52GakNKXYR8JI=; b=Mshn2TmMd/tx4A9JsjYTKX46oOcTXr4vTCF1ilMpwA6VOV+GH/2DDJoQ3oUUoTN+R0 wwg5tI0f1eZ2FE2MaNN7LQV1N8nOmx0YbVpvB1RkyoncvHClU1coxJ8rQuKr1mpWp3VA tLA2D5Dn0ntp5Q+X6j5E2BXNWtv2TaOu5+sdPsZRrgEaTVuF6DsXMQP5+FSujTAMQB59 Ll+UC3/LVHB/g0RkuCzMe519mqJGdiGt/ippUotHLUel2OXna2cKkdAiB4p48fc/U7Pk yob9px5BPGHmvKC1xor/0oAVAwz95rLJkJvOdnXbX1MhPv7I9Jt4he4UuiPCSVIYue4W ooWQ== X-Gm-Message-State: ALyK8tL3xDy1ZN6YnKuP058EQRDEipRKJ0LtUrc+gHGnpesQr91HGEN5R/e6zvDe0UzXM7NPthJjdVp6B7+Hrw== X-Received: by 10.200.50.77 with SMTP id y13mr22941613qta.5.1466440806509; Mon, 20 Jun 2016 09:40:06 -0700 (PDT) MIME-Version: 1.0 Received: by 10.55.53.71 with HTTP; Mon, 20 Jun 2016 09:40:05 -0700 (PDT) In-Reply-To: References: <57665E36.60302@lsces.co.uk> <5766D311.6030503@lsces.co.uk> <57680CF5.2070003@lsces.co.uk> Date: Mon, 20 Jun 2016 21:40:05 +0500 Message-ID: To: Niklas Keller Cc: Rasmus Schultz , Lester Caine , PHP internals Content-Type: multipart/alternative; boundary=001a113ff1705b329b0535b85bb6 Subject: Re: [PHP-DEV] New escaped output operator From: michael.vostrikov@gmail.com (=?UTF-8?B?0JzQuNGF0LDQuNC7INCS0L7RgdGC0YDQuNC60L7Qsg==?=) --001a113ff1705b329b0535b85bb6 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Davey > - https://marc.info/?t=3D145851323800001&r=3D1&w=3D2 =E2=80=94 automatic = template escaping > - https://marc.info/?t=3D135082660600002&r=3D1&w=3D2 =E2=80=94 this one e= ven proposed the same syntax! > - https://marc.info/?t=3D144225546000001&r=3D1&w=3D2 =E2=80=94 tainted va= riables also "solves" this problem These discussions and arguments against are all about super-universal-escaping operator, and that escaping method depends on context. Third discussion is even a little different thing, second discussion is more closer to my proposal. I suggest an operator for special context - HTML markup, because this is most often used context. This is shown in examlple below. Rowan > I think you are rather overstating how much of a "special edge case" it is to echo a variable into other contexts like URLs, > or JS. It doesn't need to be anything fancy, just an innocent-looking snippet like this: > > There are three different escape mechanism needed there; if there is a shorthand for one, > do you think it will be more likely or less that people will get the other two right? Actually, htmlspecialchars() is needed in all three cases: 'Say "Hello")']; ?> " onclick=3D"alert(); return false" > You may not write htmlspecialchars together with urlencode just because urlencode encodes all special characters with its own way. Imagine that urlencode does not encode quotes - what function should we call for its result? That's why I say this is very often case. The main purpose of PHP - is web-programming and generating HTML (hypertext preprocessor, yes). The fact itself, that there were many discussions about it, indicates that it is a necessary feature. --001a113ff1705b329b0535b85bb6--