Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:117176 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 72161 invoked from network); 1 Mar 2022 09:22:09 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 1 Mar 2022 09:22:09 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id C6E7D180505 for ; Tue, 1 Mar 2022 02:43:18 -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=-2.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,NICE_REPLY_A, RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H5,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: Error (Cannot connect to unix socket '/var/run/clamav/clamd.ctl': connect: Connection refused) X-Envelope-From: Received: from mout.gmx.net (mout.gmx.net [212.227.15.19]) (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 ; Tue, 1 Mar 2022 02:43:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1646131396; bh=TvaQgLYVhUgkT9K8OkTmktG9EZAG3oht6H8MIeypB4E=; h=X-UI-Sender-Class:Date:Subject:To:References:From:In-Reply-To; b=GFddKW+thQwMRtvcQnSowWmfqbCyCw9i2geS1gWTFSlitDvBLDRfMN5mM6CEviCR3 5+lQNiFWoeiEDZ2QGIU+hl3a4oY3+ZoM498n0fSbrxNUj8dNT06fc6Kr4ph+pVQ4vR f9vbwaCI1Hsz/jUx2wCC0u+G0PCJqVUSXWNkXCec= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from [192.168.2.130] ([79.220.67.100]) by mail.gmx.net (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1Mqs4Z-1o28I92BAf-00msVe; Tue, 01 Mar 2022 11:43:16 +0100 Message-ID: <0b5bc29d-3814-0e1d-b94a-47790019c778@gmx.de> Date: Tue, 1 Mar 2022 11:43:16 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.6.1 Content-Language: de-DE To: Christian Schneider , php internals References: <983552d8-11f1-b5bc-fb82-148347982fda@gmx.de> <5494eaa7-2fa6-8364-9683-a2c8c9789d81@gmail.com> <69642616-72b7-44fe-97a7-27ae03bc8fce@www.fastmail.com> <7fbed755-42e2-d023-285f-39863a97f297@gmx.de> <3665C848-B4C3-4528-AEFA-02C868748AA8@cschneid.com> In-Reply-To: <3665C848-B4C3-4528-AEFA-02C868748AA8@cschneid.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:PfGqH7/UOAZxAIXuoMCUIsda8PCqks8mtQd32WuYvUGMEH3L7xo HPQhVUo+QWkld++RdyR6dS+9X3/VPR4RQx7AzvJy6b28M8ldzAkBLtveU4lIk4KIHGqnYbf bw1ueP6F6lEEclGlgcoVZmBV/2bbhPfPuwIWOYSEHW57zQS1bzWwzVk1BI7wHGzhI8wts8P 7fAex6dmQhJPij4iJm7aA== X-UI-Out-Filterresults: notjunk:1;V03:K0:SYtYhY9+kQQ=:nX7xyU7C7T5SU2yM44ICcv EQC3bH/uU4gZGLvf13N5epUNjnS2UM4IEiQ6g/c6SRVFiQr2YqYYTn+6MJaLe7CzkYqXvqaM2 iAo4jmCyG/uXD0zdnc1j4Z+V/LAeCNHFltHiEIIB5p5p6W4mApQuH6ZsfyTf65DeWLirpbF85 gb+TjPN8NdhLvm6Vi7ZVtHf53hVcObaQNda/hqdJYjTWh0wyZwtqiUbLN0uWZbpYxUARWesZM 73NV4NomC7L10y8q0j+G+WZJNNebKkaI/xB/ID9pLh0+3nbqMFo8qhrzvSo3aDKvhq2w/Az7p ZyWDksRvp1HCIPDe/2UY9h4u/HSOoNN5UPXsfDEdCJPj1OifDTSOvojtlE3JSg3OtodcwEHvv t5FJ/OEM+n1Xkx5LW0ov/RDHuXUhrEJHj76vVD/OjFxmsiD4hPqlAwA5HhFVmGbX/OZhMNDdD YLz3pdjgnsRabGDjRGI6Pk3pnWT6/cMFc0rI1dosoUnlLc3/qE1lbSvLMqd+QGFzSTX0RK9s/ eAt8AHg8nJKrpQl2QTWckUU3lTXgf8+byX4fiDa8XD26CChJf7ZK/rGz+Dpog7+AjQKRNJS2X kgGuKGL1EXRpdil0eM44GOKYIVRhk8bUmBGLYqK8zvQAEeHJOFIp7W+JqFS5XBpCKVh3UGe7E 23xrFxNO+VjT1v8dlO2cC930uBKaAL1DDlPG8bFWEcgcAhtCBXa/cemFFwEEkhW0Ex+ghRcqq znER0/S8vT/8zohODRrO7aiANJsLGBk8tJgm7V/0k1QgQaatmN+S8p48h1c9VhPcuViVQ/jAk kAaReZnctb/W9paO95stH1hSwgBd+PsE57adJTJJNFePbx2PRFM8W+cT/kuE9VerhvpNPaYPS VyRs+fih8xY5G/Ln2C0kiKTynYfIVGz9IOmHQIjrqya8+r4aABv1c4lqtMj9OTuRZAPt2qwBt lf/FW1uBc4qABg6Ut5PL/MiLtZMEHaiISH7BGIxMqMWx32qEn4m9HW1EfvWcrdwQQ6hG2Bwc3 7scT0/qete3fAh7pouUgAgtpUvGsyO7fOVWAjADT4yvavN/k444hEG0Oc8QKMs4nRAehbhVBY wIx3S5W0XCVNns= Subject: Re: [PHP-DEV] Allowing NULL for some internal functions From: cmbecker69@gmx.de ("Christoph M. Becker") On 28.02.2022 at 23:11, Christian Schneider wrote: > Am 28.02.2022 um 22:05 schrieb Christoph M. Becker : > >> On 28.02.2022 at 21:51, Craig Francis wrote: >> >>> And after all of this, no-one has come up with a way to find or addres= s >>> this problem, e.g. >>> >>> >> $nullable =3D ($_GET['a'] ?? NULL); >>> echo htmlentities($nullable); >>> ?> >> >> > function my_htmlentities(string|null $value) { >> return htmlentities($value ?? ""); >> } >> >> $nullable =3D ($_GET['a'] ?? NULL); >> echo my_htmlentities($nullable); >> ?> >> >> The BC break doesn't appear to be that serious after all. > > I'm not sure I get your point here: If you provide a user-land implement= ation of the previous behavior under a different name then the BC break ca= nnot be serious? I said, the BC break doesn't appear to be *that* serious. To elaborate: in my opinion, it is a good thing if internal functions and userland functions behave the same regarding parameter types. As such I'm fine with bringing internal functions inline with userland functions. A somewhat reasonable alternative would be to bring userland functions inline with internal functions (prior to PHP 8.1.0). However, picking *some* functions and make *some* of their parameters nullable does not look reasonable to me; that is just a hack to not break *some* code, but still would not work for a lot of other code (e.g. code using PECL extensions, which may not be changed in this regard), and would make it harder to remember which parameters of which functions are nullable now (and which have special meaning for null, and which do simply treat null as an empty string). Since it has been brought up multiple times that it is hard to find all occurrences which would have to be adapted, I suggested a somewhat viable solution for userland code (namely to define userland functions which establish the old behavior; and of course, you'd need some tooling to replace the original function calls). So everybody *could* use this technique for those functions where it's relevant to the code base at hand= . =2D- Christoph M. Becker