Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:117676 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 99011 invoked from network); 6 May 2022 13:48:25 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 6 May 2022 13:48:25 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id AD5FB18037E for ; Fri, 6 May 2022 08:26:10 -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.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS3301 81.224.0.0/12 X-Spam-Virus: No X-Envelope-From: Received: from ts201-smtpout73.ddc.teliasonera.net (ts201-smtpout73.ddc.teliasonera.net [81.236.60.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Fri, 6 May 2022 08:26:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telia.com; s=tssemail-202204; t=1651850770; bh=2P3bYGdTFnhL8PZfmJWXg42f8O2c18JW5h5mQkbZuoE=; h=Message-ID:Date:MIME-Version:Subject:To:References:From:In-Reply-To; b=Gr1BZoSq4x2LIUJ0aZ9c4bGFWDW4twIIf8X6+/b3OufNCKKRFCQ2mUme7ONVOK2MwC4WULP6Oo3Mkfg/yW6GlowlyzBtVjyO80f0CB64PH+JzFC/tSs6F4/nwI8cQMZwICPiojPRTojsDYBW9L3gO737r+ruJyagWPHeE17nmcTkkwes4o5SnxM2KT4fUXWExF+W1akriZGD9qAUYW3CFBhVHqHmbNQ+NWftq+mrCubNU0BBsR6k4CnZ/81BEUWociMNRwwMCvgFzaB/uwIyV4hD1F8Xn7RYnBLZgMWAMcAvoSMsdhqqupX+JEk4ufHslBEKQNVUOCpawqPZmCuhLw== X-RG-Rigid: 626BF5150047BAAD X-Originating-IP: [84.216.97.240] X-RazorGate-Vade: gggruggvucftvghtrhhoucdtuddrgedvfedrfeefgdekjecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfvgffnkfetufghpdggtfgfnhhsuhgsshgtrhhisggvpdfqfgfvnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefkffggfgfuvfhfhfevjggtgfesthekredttdefjeenucfhrhhomhepuehjnphrnhgpnfgrrhhsshhonhcuoegsjhhorhhnrdigrdhlrghrshhsohhnsehtvghlihgrrdgtohhmqeenucggtffrrghtthgvrhhnpeetgfehfedvtdfgieffueekiedvlefffeffvefggfdvgfegueefveehheekuefgvdenucffohhmrghinhepphhhphdrnhgvthdptghrrghighhfrhgrnhgtihhsrdgtohdruhhknecukfhppeekgedrvdduiedrleejrddvgedtnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehhvghloheplgduledvrdduieekrddurdeingdpihhnvghtpeekgedrvdduiedrleejrddvgedtpdhmrghilhhfrhhomhepuhekleeltdeigedujeesphhnvgdrthgvlhhirgdrtghomhdpnhgspghrtghpthhtohepvddprhgtphhtthhopegtrhgrihhgsegtrhgrihhgfhhrrghntghishdrtghordhukhdprhgtphhtthhopehinhhtvghrnhgrlhhssehlihhsthhsrdhphhhprdhnvght X-RazorGate-Vade-Verdict: clean 0 X-RazorGate-Vade-Classification: clean Received: from [192.168.1.6] (84.216.97.240) by ts201-smtpout73.ddc.teliasonera.net (5.8.716) (authenticated as u89906417) id 626BF5150047BAAD; Fri, 6 May 2022 17:26:07 +0200 Message-ID: <9109f8bb-2582-2578-f702-464f921590e5@telia.com> Date: Fri, 6 May 2022 17:26:07 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.9.0 Content-Language: en-GB To: Craig Francis References: Reply-To: =?UTF-8?Q?Bj=c3=b6rn_Larsson?= Cc: PHP internals In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: NULL Coercion Consistency From: internals@lists.php.net ("Björn Larsson via internals") Den 2022-04-08 kl. 19:34, skrev Craig Francis: > Hi, > > I've written a new draft RFC to address the NULL coercion problems: > > https://wiki.php.net/rfc/null_coercion_consistency > > This is due to the result of the Allow NULL quiz: > > https://quiz.craigfrancis.co.uk/ > > 14 votes for Fatal Type Errors irrespective of `strict_types=1`; > 13 votes for NULL coercion when not using `strict_types=1`; > 8 votes to update some parameters to allow NULL; > > I appreciate some want to force strict type checking on everyone, but I > want to make sure we have this properly documented, with names, and > explanations. > > Breaking changes should be justified - if they aren't, they only > make upgrading difficult and frustrating (bad for security). > > Craig > Hi, Have been busy for a while and haven't followed all the details around this RFC, but now back on track. One code pattern to upgrade your code to PHP 8.1 and 9.0 is to use the null coalescing operator like rtrim($string ?? '',...). If one then has a legacy codebase that works flawlessly I would say that this path is the preferred one since it requires a minimum of work. To dig into your code base and address why the parameter ends up like null is probably more cumbersome. OTOH, one doesn't reap the benefits of the "Deprecate passing null to non-nullable arguments of internal functions" RFC since it requires to much work. One could argue that the "Deprecating passing null" RFC is nice, but has a flaw when applied for existing code. Applying the null coalescing code pattern is an easy way to make your code 8.1 compatible, but not sure if it adds value to the application itself. Now if this RFC is the best way to improve things if one think this is something of an issue with the original RFC worth addressing I don't know. But at least worth having a discussion about! The purist within me sighs a little when applying the code pattern above... r//Björn L