Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:79540 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 65689 invoked from network); 10 Dec 2014 19:16:10 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 10 Dec 2014 19:16:10 -0000 Authentication-Results: pb1.pair.com smtp.mail=php@golemon.com; spf=softfail; sender-id=softfail Authentication-Results: pb1.pair.com header.from=php@golemon.com; sender-id=softfail Received-SPF: softfail (pb1.pair.com: domain golemon.com does not designate 209.85.217.169 as permitted sender) X-PHP-List-Original-Sender: php@golemon.com X-Host-Fingerprint: 209.85.217.169 mail-lb0-f169.google.com Received: from [209.85.217.169] ([209.85.217.169:37475] helo=mail-lb0-f169.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 9C/47-29826-8FB98845 for ; Wed, 10 Dec 2014 14:16:09 -0500 Received: by mail-lb0-f169.google.com with SMTP id p9so2917794lbv.0 for ; Wed, 10 Dec 2014 11:16:05 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:date :message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=EYRFnB4z9Xp6UuK/Si19uxrWrTqavaDZilsgScPGYW8=; b=gKJB0/w9tYSTFROwsS2C991JVJxZAAGtV+FtRpJ7kyOleeAqlrxWGXf0WGgSYMkkk1 Lzuu4N/4tK75MBrMxcqCbrC3qRmbPZ/hxmjCC+jdUWWdUCjRvG9iSX+NhfpKDSdEfw/n ubxGLp44k5KEKA0cFwn7m87Zf8fFd8kJaYzdhdjomtMeyCFItH5t3bXt1imoTOzVZFSV WAzBKFZvZS11wE6OhoviJt2aFfBdBLV8sRnDdRRQHD5J42tdHouxHBhH5vrN1iMef0wq sY2rbi0hcoycXJnF2/5iYHrmtmHIPp2u1nZZcZQ7qmYq0CnkwODB1Ioqje6/vf+4uKTg pIeg== X-Gm-Message-State: ALoCoQlE4v9fH+/PBw2KZIVDNUgpxx8YKBavvTvFHWTJ/cLX9Sf+FRJ9jAvzsgHULTpnJTdjFZSo MIME-Version: 1.0 X-Received: by 10.153.5.33 with SMTP id cj1mr5764244lad.65.1418238965801; Wed, 10 Dec 2014 11:16:05 -0800 (PST) Sender: php@golemon.com Received: by 10.112.130.138 with HTTP; Wed, 10 Dec 2014 11:16:05 -0800 (PST) X-Originating-IP: [2620:10d:c082:1003:22c9:d0ff:fe87:295b] In-Reply-To: <98ABD377-A37A-4F25-8550-3E7684F22FDC@ajf.me> References: <98ABD377-A37A-4F25-8550-3E7684F22FDC@ajf.me> Date: Wed, 10 Dec 2014 11:16:05 -0800 X-Google-Sender-Auth: hAkSJoDKYZuCIPYu_IocPHrQzLI Message-ID: To: Andrea Faulds Cc: internals Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] [VOTE][RFC] Unicode Codepoint Escape Syntax From: pollita@php.net (Sara Golemon) On Wed, Dec 10, 2014 at 10:59 AM, Andrea Faulds wrote: >> On 10 Dec 2014, at 18:55, Sara Golemon wrote: >> I was just updating my HHVM patch to match your PHP implementation and >> an issue came up. The following code, which is valid in PHP5: >> >> > echo json_decode("\"ma\u00F1ana\""); >> >> Will throw a fatal compiler error as "\u00F1" is an invalid unicode >> escape sequence. Since this represents an unnecessary BC break, I'd >> like to propose the error handling be modified to match \x, which is >> to say: Pass the value through unmodified. > > I was wondering about that case. Previously, the patch just raised a warn= ing > but let it through unmodified. But then old code would be littered with w= arnings, > and I felt it was better just to throw an error. Part of the problem is t= hat I=E2=80=99d rather > mistakes in string literals be caught at compile time, to prevent someone > accidentally echoing =E2=80=98\u00F1=E2=80=99 somewhere. > Well, consistency would be not raising a warning at all (like with \x or unknown \ sequences), but I get your concern with helping coders catch mistakes early. I don't have the stats on how many projects are using \uXXXX sequences (with the json_decode() or similar hack to parse them), but I know FB's codebase is absolutely covered in them. > A possible compromise might be to let =E2=80=98\u=E2=80=99 through but no= t =E2=80=98\u{=E2=80=98. > Still don't like it from the inconsistency with existing escape sequence handlers pov, but it'd cover the biggest set of BC issues, so I'd be happy with it. -Sara