Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:123575 X-Original-To: internals@lists.php.net Delivered-To: internals@lists.php.net Received: from php-smtp4.php.net (php-smtp4.php.net [45.112.84.5]) by qa.php.net (Postfix) with ESMTPS id 6B39E1A009C for ; Tue, 11 Jun 2024 03:36:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1718077068; bh=jvKR0JkC1gdMCP7qSlQWdDfi/NJitwE3bzIRH+rRkM8=; h=Subject:From:In-Reply-To:Date:Cc:References:To:From; b=fj1mAJqsYbzI20KSYnd2YX7IVPvZ6jobMjFH4ni852C800JTbbUhI+/Z7L2S78Smp OkU1lIydHaRFEBsKwYjkBeDgTwqs/oT3ZxWCDiqTHuWq7yesLpEO7XGiiLdyl2Uev7 hDiDJmLt7YVkztDzPxQ7mK/RrMwfAXasNKXQDYvvOl5bX1WPsPHV8uCsGYeFP+aiXv RfkcYSEmGLm101r9AXJ4N0kzLNVEDLoKqX3+PWygApCikSaA83M4epRrj/sPw8pgV3 gQ47s32CQbyou/DqU59Gh+N2jF8WoBRew4NO5zq9iPWkEsRm83KzcXX0AYJunYOiLo GwUhFYblMJJgQ== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 2A73F180056 for ; Tue, 11 Jun 2024 03:37:48 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on php-smtp4.php.net X-Spam-Level: * X-Spam-Status: No, score=1.9 required=5.0 tests=BAYES_50,DMARC_NONE, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: Error (Cannot connect to unix socket '/var/run/clamav/clamd.ctl': connect: Connection refused) X-Envelope-From: Received: from mail-yw1-f176.google.com (mail-yw1-f176.google.com [209.85.128.176]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Tue, 11 Jun 2024 03:37:47 +0000 (UTC) Received: by mail-yw1-f176.google.com with SMTP id 00721157ae682-62a08092c4dso7167007b3.0 for ; Mon, 10 Jun 2024 20:36:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718076999; x=1718681799; h=to:references:message-id:cc:date:in-reply-to:from:subject :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=guAnQvNh+8CQaxLScufWt99/gSSj8L+eZrqSNgYDuUQ=; b=AZDH5pk2wiUM79mp2TU1pJCFhCyUJt40srifQRDaTiuG285pgD/lDN3xw1ZVjgSSEi G+GVCvMyUraaQgJ23MKjj0eQ12FpHDNiJJQKOofk4uXhJqU0UucWOnf2OBDJZ/Uj6Gfd qmldvHSimXWxEyfjVZFXpqpI3og8FRZTCB+JBtNt6VJIDRoh8O9l2bH4URhvgaqoA6du SbI2B0SXU790tMavfvD3xzxsu5IvbCbWhIfBOmlswQPv9qNeeFOy7K9S5XkQXv0YGu7O QfTv9Gyvw/SFQsUoh5HOz5QBQ/clrZMcBcEXVDUiZYi1isLUvXAX7wyU1AYt8AGDuQiF X0wA== X-Gm-Message-State: AOJu0Yzn632khpIEKS+Nne3Xe1joVY2dumlsWBnRLhu/i471ZJJwkJCH xMY6vk1SjPqR6xOAcSsmO4iLRo1qLAfTR+E8FZT1plOp1BBQWOJSUZP8fTwCOismP1pd1WWwegc = X-Google-Smtp-Source: AGHT+IGRLUheC01VkCSLrftG2WogM/GasRXhRhO/QHPJqjq18nb2zRQj5Sz7Nv+4yJjjNa/S8nmhRA== X-Received: by 2002:a0d:e2ca:0:b0:62c:e8a2:305 with SMTP id 00721157ae682-62ce8a203a2mr77363987b3.41.1718076997897; Mon, 10 Jun 2024 20:36:37 -0700 (PDT) Received: from smtpclient.apple ([12.160.222.143]) by smtp.gmail.com with ESMTPSA id 00721157ae682-62ccae47931sm18587947b3.87.2024.06.10.20.36.36 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 Jun 2024 20:36:36 -0700 (PDT) Content-Type: multipart/signed; boundary="Apple-Mail=_D242B23F-96BB-4EE5-BC6B-9A722B6900E4"; protocol="application/pgp-signature"; micalg=pgp-sha256 Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3774.600.62\)) Subject: Re: [PHP-DEV] Revisiting case-sensitivity in PHP In-Reply-To: Date: Mon, 10 Jun 2024 23:36:26 -0400 Cc: php internals Message-ID: References: To: Valentin Udaltsov X-Mailer: Apple Mail (2.3774.600.62) From: ramsey@php.net (Ben Ramsey) --Apple-Mail=_D242B23F-96BB-4EE5-BC6B-9A722B6900E4 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On Jun 10, 2024, at 20:35, Valentin Udaltsov = wrote: >=20 > Hi, internals! >=20 > 9 years have passed since the last discussions of case sensitive PHP: = https://externals.io/message/79824 and = https://externals.io/message/83640. > Here I would like to revisit this topic. >=20 > What is case-sensitive in PHP 8.3: > - variables > - constants (all since = https://wiki.php.net/rfc/case_insensitive_constant_deprecation) > - class constants > - properties >=20 > What is case-insensitive in PHP 8.3: > - namespaces > - functions > - classes (including self, parent and static relative class types) > - methods (including the magic ones) >=20 > Pros: > 1. no need to convert strings to lowercase inside the engine for name = lookups (a small performance and memory gain) > 2. better fit for case sensitive platforms that PHP code is mostly run = on (Linux) > 3. uniform handling of ASCII and non-ASCII symbols (currently = non-ASCII symbols in names are case sensitive: https://3v4l.org/PWkvG) > 4. PSR-4 compatibility = (https://www.php-fig.org/psr/psr-4/#:~:text=3DAll%20class%20names%20MUST%2= 0be%20referenced%20in%20a%20case%2Dsensitive%20fashion) >=20 > Cons: > 1. pain for users, obviously > 2. a backward compatibility layer might be difficult to implement = and/or have a performance penalty >=20 > On con 1. I think today PHP users are much more prepared for the = change: > - more and more projects adopted namespaces and PSR-4 autoloading via = Composer that never supported case-insensitivity = (https://github.com/composer/composer/issues/1803, = https://github.com/composer/composer/issues/8906) which forced to mind = casing > - static analyzers became more popular and they do complain about the = wrong casing (see https://psalm.dev/r/fbdeee2f38 and = https://phpstan.org/r/1789a32d-d928-4311-b02e-155dd98afbd4) > - Rector appeared (it can be used to automatically prepare the = codebase for the next PHP version) >=20 > On con 2. While considering different transition options proposed in = prior discussions (compilation flag, ini option, deprecation notice) I = stumbled upon Nikita's comment = (https://externals.io/message/79824#79939): > May I recommend to only target class and class-like names for an = initial RFC? Those have the strongest argument in favor of = case-sensitivity given > how current autoloader implementations work - essentially the = case-insensitivity doesn't properly work anyway in modern code....I'd = also appreciate having a voting option for removing case-insensitivity = right away, as opposed to throwing E_STRICT/E_DEPRECATED. If we want to = change this, I personally would rather drop it right away than start = throwing E_STRICT warnings that would make the case-insensitive usage = impossible anyway. > It makes a lot of sense to me: a fairly simple change in the core and = no performance penalty. At the same time, a gradual approach will reduce = the stress. >=20 > So the plan for 8.4 might be to just drop case insensitivity for class = names and that's it... Let's discuss that! I=E2=80=99m not saying I agree with or support this, but I think your = proposal has a better chance of being accepted if you target PHP 9.0 = instead of 8.4. Cheers, Ben --Apple-Mail=_D242B23F-96BB-4EE5-BC6B-9A722B6900E4 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEObZBND2MEEsrFG3D+cOdwLlphUQFAmZnxjoACgkQ+cOdwLlp hUR+lQ//bOmJLzA79DOgXQLGQSfMzRKt+hUaP7FJjXf9LKXs06Gf8PNZLjKaCBKQ ekbu16kPWf5VUfYT0QCLgDLxkJ0sQh2hjVCYElH21Uuj8RAfnEM1tWnqM+pCeSBI PJiGa0nLvSj/0QbPT7GSLTtIi/5+1tG9R44LER5Udok6cetTJlGdpoOQ8R/yM/Rr 2wHsTkhlbsrIMUpczKiwXL3gx14LV/0UClpnsyvQFu9jf+MHU2wvAA7nPK0gZ6SY 16sjWfBMd6tDpxPQYdIr8BXRRZnlZ8pEv8FYwitVRwaqJW4wDp1Tm7tQ7joG3vY4 K2iarm9CqLZs3K1MIE4zj75aqO9eQvZTwA+LAfiAJVPkHr9zdC8OZqLtYyXPn+M1 QX18gcHoxPKASk0HkS849lGXFBEJQj8rntpMQahC+KhdYIK7B9tl6uChBilVkWMq YTMLUn1XPxTfsLCAOb6jQI7eM9kXpVOq7/iul9HOevA1MeAsaKIy14OEp35b0itH lr0CMf/FK9C/0qvcE0ntI5neSdWlsCjZy1xJU+72CbXFB3E1XMdTND6CIw1DGBP2 Oicv29r+/+cNRqIN3jV3LakouD0EBfKaZUzV5m0plCMfBMUsrxsa2Eh3E6traC6u AIm/ThQjhdmtT5uKJU8aLTNSZcObOIy9oc55vfO4ratECTp83Ok= =GWuT -----END PGP SIGNATURE----- --Apple-Mail=_D242B23F-96BB-4EE5-BC6B-9A722B6900E4--