Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:117555 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 75012 invoked from network); 20 Apr 2022 17:28:58 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 20 Apr 2022 17:28:58 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 47DCA180541 for ; Wed, 20 Apr 2022 12:02:45 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,NICE_REPLY_A, RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS8560 212.227.0.0/16 X-Spam-Virus: No X-Envelope-From: Received: from mout.gmx.net (mout.gmx.net [212.227.15.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Wed, 20 Apr 2022 12:02:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1650481363; bh=J6awvFB6nZbATgrNTCuHN538hAY916xs3rhplNrCMqM=; h=X-UI-Sender-Class:Date:Subject:To:References:From:In-Reply-To; b=ZyZ0owaZShI+i+pgfs/dKgebrh1uUFjSlWppXa5yDVsocR93bnl3yl1FhAblezaDL mWCRm+Oo+i1R1UWWHd0rlQacXI3+VXGxUAieNRmpyXP9iTHHIo/8nicmtwg43foBuw SVvL45OCikLv2BzYDKK55l7faz9mHbXSNBqUAXuA= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from [192.168.178.120] ([24.134.51.41]) by mail.gmx.net (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MxDp4-1o5UVv0rSy-00xcsL for ; Wed, 20 Apr 2022 21:02:43 +0200 Message-ID: Date: Wed, 20 Apr 2022 21:02:42 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.0 Content-Language: en-US To: internals@lists.php.net References: <2035695b-b6b5-5982-a5ea-e85693e1f71f@gmx.net> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:66qjvfAbiONRjvcljHAd0zz7Yu3ug5DNp9rbp4dxzBAsq9MMhAN u24UiyzCrnUxLIeEW34h0IKJQ/wF7RvVobKX6exdZMB8jWo9YLBFV6syvzWbe5iTufBZQP0 Sj6X/YChdTO1scR/z18eUgUTIh0pdOl77ilJgjR1uepqoaJn1PBriToV5YPzRqrn5NowOjn QWaOKOwx063QEct/Tbthg== X-UI-Out-Filterresults: notjunk:1;V03:K0:5tYu10HAflQ=:yesAltyy8BR7EgH16ULIKe qaBUsrNnlAjl4D7ItY8fYHnFMf6BNzeHZe8rSbRfxzU2XAwRGUTdy1YsmiNVPspGvc1PCCmNB yMm33ZhLUGR9sjFmkjEmse3Qvqir3Qf/rWSSc0roGfRiqGSL9CJhBxxJUaFh+ibu60wTaZYMq PNsWd0ybOsCoQ8IH08tIoP03IUTG4TqDtnWm0mMbbIF7Pdgd8uQEytvnXezLIAIFFvjTVVBpe jZAlu0t45LAgg17mmISSlg6+yC05TyUgcXQk+Q198VOah/19AeGx2XJoSlbpdPHyGEL3DEo07 SRhhvDtuV8orHoETHW5/2tySqcZ7DBpoIkDoH38dYfPdX4vkx/bt+3mCAllcBhHmEvysHWI3M 7zIsAoFBhxUDaTYj01/ldA+gtc3twVZjHSceOLQGXWDgi01mPdlJdeKxnzw7yeylrEl/y1S/D l4kk/PTaIqXJ2OnPPjQVuBrI6ki4pjsh1iLBNPhGakrlfs108KNdlSgT8vJ5VsN+pP08d8JsP wB8lPQw4Gz4tQfYADUsR5G0E724OtzWa/QDpF4+bmQ2KxSZGHBbMkUUFcLD0cvIHOhfoSVbD/ 8CHxeg4fqf4eAZGEbuTDPrTKwBEZnQX0ZLFIE+el+klnq2bDNvhkfgfbDsZGWgRgl+nDrJg6w 1CsLRPqBD4f1AXxmgyP6T/BAeFFKjigBTlAJ89wbczI1kOvky0kfe0hWaAuaGA2uhm6QnT3f0 HX6IHXyDkDdYOJD3T9kPI0lK4eG6u9NZhm0UPMZFn1hBnG87KWsc3lRm+8q6ioUCtKYD0wFPB 20K8tBEEzbfiEAErpm3Z+TSQGkI+QsLFrwUSlO6MyyM/9JmxdMtGHpqKdZcXiah4pbOlJXUD1 N7xal3RXFyEiIqL+NKMQiUgYrksob4vy7kBMnYplX9+9FvTLrrsXnsw8y7Ki77uHfpgfewP97 +LsgLtdvYIKmhc/a5bakKAXsd1aWjYwXCtGUrrV/7l9nuOZIM2neNfzu0uV+E3Pf4US40Dphw o4K8A35MM6SqUVSHEWkoNyQeFZZMuv+WN7IC5rldBfxYvcMg5GUC08hEdGCKElyRyrXVLfaUa 3r3ZtLrVgG8mPo= Subject: Re: [PHP-DEV] NULL Coercion Consistency From: a.leathley@gmx.net (Andreas Leathley) On 14.04.22 14:14, Craig Francis wrote: > Yep, I agree with everything you have said there, and it's what George > seems to be working towards (which I also agree with): > > https://github.com/Girgias/unify-typing-modes-rfc > Yet your RFC goes exactly against the quoted document by making the differences between strict_types larger. > I also cannot explain why NULL should be rejected, other than for those > developers who see NULL as an invalid value and also use > `strict_types=3D1`... as in, when a team of developers spends a few hund= red > hours adding strval() everywhere, what does that actually achieve? what = do > they tell the client? does it make the code easier to read? does it avoi= d > any bugs? or is it only for 8.1 compatibility? I don't get why you would add strval everywhere. Why are you getting null everywhere? In most of the examples in your RFC "null" is specifically chosen as a default value and could easily be an empty string (why do something like "$_POST['value'] ?? null" if you actually want an empty string?). For the framework examples, the second argument of these functions is the default value - it does not have to be null. And "filter_input" I have not seen in a codebase yet, probably because of its weird double function as retrieving an input variable and also filtering it, with both null, false and the result as a possible return value. The few cases where I encountered the deprecation notice it was always a mistake and easy to fix, and I was glad that was pointed out to me. There is another 3.5 years until PHP 9 is likely to come out, which is a lot of time for people to adjust their codebase. I could even see an argument for not promoting it to a fatal error in 9.0 if so many people need more time. Removing the deprecation and changing fundamental aspects about the type system in PHP by auto-coercing null just so people do not need to update their codebase seems like the worst possible way forward. So far, your RFC does not mention the arguments made against your proposed changes in an understandable way. George Peter Banyard wrote some extensive arguments and you have only included one sentence without any of his arguments and try to refute it in the very next sentence as not really an argument, and it was mentioned by him that coercing null in other languages like Java has lead to problems. Comparisons to other languages could be helpful, as NULL is not just a value in PHP - NULL in MySQL for example also cannot be coerced and is its own distinct value (it even has its own syntax for comparisons). I am still bothered by the language of the RFC in general where you often write things like ".. it hasn't been the case for everyone else", "most developers are not in a position" and so on. Assuming you know what everyone is doing and how everyone is doing it in an RFC does not seem constructive. All the numbers you cite are also circumstantial and not about the supposed problem discussed in the RFC - for example, you assume people not using static analysis are in favor of your RFC, even though this is pure speculation. Compared to all the other RFCs in the last 3 years I read through I don't only disagree with this RFC, I also think it is not very well reasoned about and does not convey the discussions that were held about the topic on this mailing list. It mainly contains your opinion, which seems insufficient for an RFC.