Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:100537 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 95059 invoked from network); 12 Sep 2017 12:53:09 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 12 Sep 2017 12:53:09 -0000 Authentication-Results: pb1.pair.com smtp.mail=francois@tekwire.net; spf=softfail; sender-id=softfail Authentication-Results: pb1.pair.com header.from=francois@tekwire.net; sender-id=softfail Received-SPF: softfail (pb1.pair.com: domain tekwire.net does not designate 212.27.42.4 as permitted sender) X-PHP-List-Original-Sender: francois@tekwire.net X-Host-Fingerprint: 212.27.42.4 smtp4-g21.free.fr Received: from [212.27.42.4] ([212.27.42.4:47808] helo=smtp4-g21.free.fr) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 2F/32-10715-2B8D7B95 for ; Tue, 12 Sep 2017 08:53:08 -0400 Received: from [172.16.0.23] (unknown [158.255.108.131]) (Authenticated sender: flaupretre@free.fr) by smtp4-g21.free.fr (Postfix) with ESMTPSA id 8DF8419F5D8; Tue, 12 Sep 2017 14:53:00 +0200 (CEST) To: "Christoph M. Becker" , "internals@lists.php.net" References: Message-ID: <6601584d-c76d-4ed7-b4d6-b95e1b401cae@tekwire.net> Date: Tue, 12 Sep 2017 14:52:59 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: fr Subject: Re: [PHP-DEV] Deprecate and remove case-insensitive constants? From: francois@tekwire.net (=?UTF-8?Q?Fran=c3=a7ois_Laupretre?=) Hi, Le 12/09/2017 à 14:02, Christoph M. Becker a écrit : > Hi everybody! > > Usually constant identifiers are treated case-sensitive in PHP. This is > always the case for constants defined via a `const` declaration. > However, define() allows to pass TRUE as third argument to define a > case-insensitive constant. This feature appears to potentially result > in confusion, and also causes bugs as shown in > . See an example created by Nikita to see > some probably unexpected behavior: . > > Even if these issues could be resolved, I still think allowing both > case-sensitive and case-insensitive constant identifiers does more harm > than good, so either case-sensitive or case-insensitive constant > identifiers should be removed from the language. Since case-sensitive > constant identifiers are already the default, and HHVM doesn't even > support case-insensitive identifiers at all, I would suggest to remove > case-insensitive constant identifiers. > > This could be implemented by triggering E_DEPRECATED whenever the third > argument to define() is TRUE in PHP 7.3, and to remove this parameter > altogether in PHP 8. Most likely some further simplification in the > engine could be done then as well. > > Thoughts? What about making PHP 8 100% case-sensitive (except true/false) ? If we announce it years in advance, it is possible, IMO. Regards François