Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:116760 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 14419 invoked from network); 2 Jan 2022 12:34:40 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 2 Jan 2022 12:34:40 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 7661D1804E3; Sun, 2 Jan 2022 05:41:19 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,NICE_REPLY_A, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE, SPF_PASS 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.17.21]) (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; Sun, 2 Jan 2022 05:41:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1641130876; bh=iDEOfxzpLW7SRl+7n0LgV9ot08IdLduHDoJQaTjlRTE=; h=X-UI-Sender-Class:Date:Subject:To:References:From:In-Reply-To; b=PjD/FV6TTcUMKcLpxhRYSY1v9undZCjoESGBx/G+vscBu1YeFHOF1xONq+Rw3oW0r ihb8zJ1fGtmB1OGnJVhNPd51ZSFNAgUXOZaUkcNdT92xjhPfBEyXuUqVQ/m+RKixo9 Bc2pqfTimZK6dFxVvrLcmbbg5pkzZXZiOGgFVtSY= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from [192.168.2.130] ([79.222.42.193]) by mail.gmx.net (mrgmx104 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MCbIx-1nD3Nv0NW7-009kmV; Sun, 02 Jan 2022 14:41:16 +0100 Message-ID: <8a644158-9c54-f73d-ef74-79642f70f9c4@gmx.de> Date: Sun, 2 Jan 2022 14:41:15 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.4.1 Content-Language: de-DE To: Craig Francis , Sara Golemon , PHP internals References: In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:kIcQnd6NJ23vqM22+8+2c14DVli/fYkfwxXv0+HTbpFei8F+IfE FgDASzuL2iEf9SHBemjesEJxVdyCudd1h4BrqBTKl47Z7pIoIF1h7MR4sCiO6+3csIRAElc CAf09m5/bNFBoa87JVTXWbdFmT7mhESInTtEgxyer77T06HAkivqpJkrPyCY77vx+fDS/c/ TlmvNHqMnVCBypS2vMGVQ== X-UI-Out-Filterresults: notjunk:1;V03:K0:DZNiVpHndWI=:lRukKw1MWncSI3cXoPBu11 TC6JB3EQouzDsrjH+whuQfxMF7BaMz0zaucaYySX36J3nLaHNJbE3tA/pge5wAPQHo2fZW7ri r7zV20ZtZGcGUDvTnjwrwd0yrGbz0xat8HoRlaOOFDxoWZc8NR5uKGLowlZuku4GyEvSHgHYd OtfVqEgGhvEkkF/41Le7nQL7ESP8tHQMnHyKKWt33sYgFdpHd1P+f4PiVnfcUt8LCMo8lzKhS h0ajeFiW//HJMM7f/A0noW+d+3C2SPgybsL6hqXa1f7NHYeyZZVqXjlUTYXwtrUgdKrnX0yUR hdYy8sCV/KWq0dNG448guzR/v9gLZyz0CDYB2OYr99ON7wKwchupxRv0h3kksS2IMevbQKdkI nqsxLj9/h/PrkB8V70qvJhyDQLInfFyTJKHqU04b3HlXV9Y+fq63nvnQ5xg4fGqoqDnoNVJAP XWHx1hzxjT4WNq9POk/PYVv8OP1xGG5cveC6IrizXkrCmP7z6qSi8FWOnJoKtMJrlI5PK9K96 8SA0BbU52gr5pbi4gqQ4BVegEsZksy/7gp+m7EdcdPdagfsQ2waKgufekWLiar/+z6A3Wd6ad MXQlxlxmS5YA5mJZ5iXUtHeC8pLQU4BES+Qz4CmQoD0j1BAn0ITtomPaZO6KauckaQGkAoR+X A+3Oz5FSOT0HPCm8tp/ZeyDyRhUtnsijpoOHKT/lV2xrnVG3qnGBxzbjkksZX8jFHNTC6YF2Z hVWQh4f8Kw5tXaJPMje9jEPXd+7JjWR5wJLVpKWMoEssh0BvwAeQzX/+8CwGG57NQRRk0/lis PMGfOYILYz35fMRVzJH2zGuZSr4KjZ+ZMZyqlT1HkXWfPTvrMIQQs9T7bCEULfu3YQTOi0Vc0 IBnnX5klwsgCLNr+U8/1VoEIserW2NKx5+04v6ug+baC+ZOx0CrY/i7elpeCH48iuiN8fLuDU ZMjPZEhkn+AHGTLTVKHnbp7IEh/HyB+/685c582gSba/ayY5c00JhRkiHZxR8w4brkzcKegQ/ PIRqqKIb8HlRwQKUmYAsKZYWLMl4u2Ky9tUNo+5uefbC6qnQJ+vzk02J9QcbL//ydwtpwwvCH AEDKC6n6sAponw= Subject: Re: [PHP-DEV] Allowing NULL for some internal functions From: cmbecker69@gmx.de ("Christoph M. Becker") On 02.01.2022 at 00:17, Craig Francis wrote: > On Thu, 2 Dec 2021 at 15:19, Sara Golemon wrote: > >> On Thu, Dec 2, 2021 at 8:48 AM Craig Francis >> wrote: >> >>> Is there any value in me proposing an RFC to update *some* internal >>> functions so they can accept NULL? >> >> I'm not hard against this idea. The interpretation of null in these >> contexts as being equivalent to empty string isn't unreasonable. I gue= ss >> the only objection I could have would be an academic one and I can't re= ally >> defend that. So yeah, sure... why not? > > I've spent a few days coming up with a short(ish) list of parameters tha= t > are likely to receive `NULL`. > > The focus is on making it easier for developers to upgrade to newer > versions of PHP. I'm thinking of the typical developer, probably using > WordPress, isn't using Psalm (at levels 1 to 3, with no baseline), and > isn't using `strict_types`; where they don't really have the time to add > strval() to everything that could be NULL. > > Draft RFC: > https://wiki.php.net/rfc/allow_null > > And the list, where I'm proposing we only relax this requirement for the > *bold* parameters: > https://github.com/craigfrancis/php-allow-null-rfc/blob/main/functions-c= hange.md > > I'll give it a few weeks to see if there are any parameter suggestions > (welcome via email, pull request, carrier pigeon, etc), then I'll start > looking for the best way to implement this. In my opinion, it makes no sense to special case some functions in this regard; the selection of which parameters of which function to special case will always be too long for some, and to short for others. And even if we find an acceptable compromise, what about functions of external extensions (e.g. PECL packages, but also others, maybe private packages). We have not much, if any, say on these, but they will be affected by the deprecation anyway. And then it's totally unclear to me how this is supposed to affect strict_types=3D1. Either the respective string parameters are made nullable unconditionally, so null would be accepted in strict mode as well, what doesn't appear to be favorable. Or do we want to special case this kind of nullable parameters, so they are only nullable for strict_types=3D0? In my opinion, that would be the worst possible outcome. How should this even be documented? If the BC break is deemed to serious (maybe for string parameters only), we better consider to undeprecate this, although that would make internal functions behave differently to userland functions for strict_types=3D0. But frankly, in that case the original RFC[1] should not have passed, but it did, with 46 votes in favor, and *none* against. [1] Christoph