Newsgroups: php.internals
Path: news.php.net
Xref: news.php.net php.internals:100535
Return-Path: <cmbecker69@gmx.de>
Mailing-List: contact internals-help@lists.php.net; run by ezmlm
Delivered-To: mailing list internals@lists.php.net
Received: (qmail 89945 invoked from network); 12 Sep 2017 12:02:44 -0000
Received: from unknown (HELO lists.php.net) (127.0.0.1)
  by localhost with SMTP; 12 Sep 2017 12:02:44 -0000
Authentication-Results: pb1.pair.com smtp.mail=cmbecker69@gmx.de; spf=pass; sender-id=pass
Authentication-Results: pb1.pair.com header.from=cmbecker69@gmx.de; sender-id=pass
Received-SPF: pass (pb1.pair.com: domain gmx.de designates 212.227.17.20 as permitted sender)
X-PHP-List-Original-Sender: cmbecker69@gmx.de
X-Host-Fingerprint: 212.227.17.20 mout.gmx.net  
Received: from [212.227.17.20] ([212.227.17.20:52279] helo=mout.gmx.net)
	by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP
	id 0C/51-10715-2ECC7B95 for <internals@lists.php.net>; Tue, 12 Sep 2017 08:02:42 -0400
Received: from [192.168.2.106] ([79.243.117.113]) by mail.gmx.com (mrgmx103
 [212.227.17.168]) with ESMTPSA (Nemesis) id 0LjZn2-1dKawA2kOG-00bfDL for
 <internals@lists.php.net>; Tue, 12 Sep 2017 14:02:38 +0200
To: "internals@lists.php.net" <internals@lists.php.net>
Message-ID: <c7746903-2e3a-3e86-59c9-63483b244feb@gmx.de>
Date: Tue, 12 Sep 2017 14:02:35 +0200
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101
 Thunderbird/52.3.0
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Language: de-DE
Content-Transfer-Encoding: 7bit
X-Provags-ID: V03:K0:tml888VoZz07+QAi0N47/c0M7hysD0bwCut0HcnlHaQqWsHgF5J
 1yYbAGxYucN+FoiU13xeWDtAitcrpGrohstZPAKqXQLJpM2mKJlPqMb28I3Oka9Uo0EDH5o
 DG5q5hlKlXTixN8ps9TgPmg79rb37Ypu4KBhp9PxszG1p4H16dtCqavrjynvmH6k1jbFTCA
 MFKMEU67AJuM35XS6Be7w==
X-UI-Out-Filterresults: notjunk:1;V01:K0:Z1adRgBgEoM=:/4blfGe72W+hJGTZN1Sndo
 Xbrf57mGD7yZoJBWRp5yX4EoZtuRcK6KiQfAT6E4e0Gn5F0paqLgGkmaD2Nw7tEYdhqn8EYrE
 Ame3c7PKwPpuVkmBoy6q52HPs407CjyxI9hD4pkNfzwrvcNGxrb4WrsKQxy5mDbPXt6UkAh47
 duV6Z+DFRJ5Rvz9hnufCbhzSJ9fKhV0ILahZ9xtTpu+XkOIulEugyP99iURmI55zNsTOFno0e
 9WlfPs3qBhat9NSdgjLR+zvEuANBtauC3tKoCb6XU6dvR+7pWT1zCbR3kEh/dKufe/dP7QpBP
 nbW6ki+EA1/qiwbKDo0qvhuKA9r7piMRqAGIrIcElUTjWygCSLnM/sXNSxcpc9m87fuLUK+LV
 lGrhZxd3Vct8RWfvQd4KkUHkRC3CpnNLlnoN7TJLIbQqkcJeJ8pnnrbyOlPVbnOT6GzIXiaVM
 qlECNKCTizFtP1lMIoN/8x1qBCrWtXsodC5SFQQOcCgX4ikFSCb8NpihDegieWtpACuYaT3Qz
 gCfXfr2Kh8U+kLhY+CDueSRkQIp/OSr3p6o8sJBXa3xi5A6wHnqwSkmE4wdfAdUFzCBm3a8A7
 0KdO3MqfO+2L9bJb/Vhg0GExdjOAX4xIQwCpxmkzV27PzIExxEu/T5OAeQIQdgoXrKOokeco1
 V24sQaOKPh+oZMWDFu43XJF0aVTOIX1ZOKlhv3M0eeBYdwi9pan7Oh3LBwBIwG700k8SYsIK2
 uxnmFzTaXHZUUDQDOoxNiQITnMOlFS90VbuCEqovScYNN6VfyNI202V6Qd1pkg7d9psE+caNk
 wc+SZTAGoTqZJuDnDBi36BqoHV/dJQ/KGxZshrHybnejGmyc7M=
Subject: Deprecate and remove case-insensitive constants?
From: cmbecker69@gmx.de ("Christoph M. Becker")

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
<https://bugs.php.net/74450>.  See an example created by Nikita to see
some probably unexpected behavior: <https://3v4l.org/L6nCp>.

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?

-- 
Christoph M. Becker