Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:100592 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 5343 invoked from network); 14 Sep 2017 13:53:43 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 14 Sep 2017 13:53:43 -0000 Authentication-Results: pb1.pair.com header.from=nikita.ppv@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=nikita.ppv@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.214.49 as permitted sender) X-PHP-List-Original-Sender: nikita.ppv@gmail.com X-Host-Fingerprint: 209.85.214.49 mail-it0-f49.google.com Received: from [209.85.214.49] ([209.85.214.49:54256] helo=mail-it0-f49.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id E8/DF-19300-4E98AB95 for ; Thu, 14 Sep 2017 09:53:41 -0400 Received: by mail-it0-f49.google.com with SMTP id 85so253257ith.2 for ; Thu, 14 Sep 2017 06:53:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=/yPYsS2ZCtNU3vtqUmL34qRqQGH+TxsXgcxj9hcr8PI=; b=N0OogkU5kGLrA+NFecUlSr+UfxzYRBwkt345WYh2xbTwlH7dQRJaa71OGR2cndTmiM 9w1Tk14/7Ob5XErLNdWJAMW/XPjZ1IAVAi0/qnG0OGeZ0yX+N6Dp2EYL6xKsQxMyotuy 0wYbf/Bxvw12+ZAOcDtvW9o3QHd9IXyckH/FK37HJsX/OTvMzQotieWimvbcFas2vFKw Ckt4TtDI+lPCsJnTrefh86/bdtkxGHU2m8YhyJMwv6SOUvBgR62jUO82+viWGF+LGO7p G7GMUf3tmLkeg65NTT5SyrZxaQJEd0//bMP7TwiU9our/V3Qju0gpMLRpECsnAskrZcC ydog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=/yPYsS2ZCtNU3vtqUmL34qRqQGH+TxsXgcxj9hcr8PI=; b=osb2FD41XeSDPAK5ng3I5teb+vtO5Tyz9GXAWAbddmhPt8Oy1t7nWsfbBprEiR86i9 sYdv/bivvJqnsU3HVrYM9IYXBp1qSt4boc4M4C1wZMysqrHsFWRiYVhpH218wsVNsbWn o5YyHwFt9NzIq5S5Z97wWF2BHIieGSSl4WzAi/tiCAAzFuR4ODP18yj/YU+9qnU3HcsB VrZZlJi/qd1GSXIz8BWUTACQ9cJNR+MJF43wnzpsFhzIeJIEw7BbqqITXpYKcmCWDX7L auKlWe0z7v/z4ZoK/G0Q43IYhDFPiSdWFLwJBao0yFuo9VC+UH+SVwY/qvjJLPdhy7Na W/Kg== X-Gm-Message-State: AHPjjUhVTl5kWqdwIbb4jKTNIZoJNCgz7WdTIjb2UsWU3eMaK4RB1vLY GjBRHPpJuOjYKA0eXV8uLkAAEu8ZAnMoNP3qxtY= X-Google-Smtp-Source: AOwi7QCyMXWgJ92Or3fnq8hW342r993BxjeBB84t+BhlkLCThnAnwrX13dTROPMFZDJYVrBnCgnH/HWJ9yZod2Eccw8= X-Received: by 10.36.149.196 with SMTP id m187mr138953itd.75.1505397218309; Thu, 14 Sep 2017 06:53:38 -0700 (PDT) MIME-Version: 1.0 Received: by 10.107.13.3 with HTTP; Thu, 14 Sep 2017 06:53:36 -0700 (PDT) In-Reply-To: References: Date: Thu, 14 Sep 2017 21:53:36 +0800 Message-ID: To: "Christoph M. Becker" Cc: "internals@lists.php.net" Content-Type: multipart/alternative; boundary="94eb2c05e6e6719b2c0559269af9" Subject: Re: [PHP-DEV] Deprecate and remove case-insensitive constants? From: nikita.ppv@gmail.com (Nikita Popov) --94eb2c05e6e6719b2c0559269af9 Content-Type: text/plain; charset="UTF-8" On Tue, Sep 12, 2017 at 8:02 PM, Christoph M. Becker wrote: > 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? > +1 on doing this. I can understand having case-insensitive constants, but having both case-sensitive and case-insensitive at the same time is weird and rather useless. I imagine the only reason why this "feature" exists in the first place is to support arbitrary casing for true/false/null, which is better handled by special-casing these particular constants (something we already do for various other reasons). This will simplify the language, reduce implementation complexity on our side and resolve some bugs that are infeasible to fix otherwise. Nikita --94eb2c05e6e6719b2c0559269af9--