Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:117560 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 46835 invoked from network); 21 Apr 2022 13:06:47 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 21 Apr 2022 13:06:47 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 00A67180380 for ; Thu, 21 Apr 2022 07:40:48 -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=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS1836 195.49.0.0/17 X-Spam-Virus: No X-Envelope-From: Received: from darkcity.gna.ch (darkcity.gna.ch [195.49.47.11]) (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 ; Thu, 21 Apr 2022 07:40:47 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by darkcity.gna.ch (Postfix) with ESMTP id E0E0D151668F for ; Thu, 21 Apr 2022 16:40:44 +0200 (CEST) X-Virus-Scanned: amavisd-new at example.com Received: from darkcity.gna.ch ([127.0.0.1]) by localhost (darkcity.gna.ch [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id w-wXs7D8Cy5v for ; Thu, 21 Apr 2022 16:40:43 +0200 (CEST) Received: from smtpclient.apple (unknown [IPv6:2a02:1210:2ea4:cf00:791a:bcd1:2e8d:2aad]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by darkcity.gna.ch (Postfix) with ESMTPSA id 046401516680 for ; Thu, 21 Apr 2022 16:40:42 +0200 (CEST) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.80.82.1.1\)) Date: Thu, 21 Apr 2022 16:40:42 +0200 References: <42D0A480-F262-4F72-9C4D-887762A8D800@gmail.com> <0b061f28-a087-efd3-8602-424ee03458e0@gmail.com> To: PHP internals In-Reply-To: Message-ID: <88B1540B-3E99-45E2-87F3-F967D90C691D@cschneid.com> X-Mailer: Apple Mail (2.3696.80.82.1.1) Subject: Re: [PHP-DEV] NULL Coercion Consistency From: cschneid@cschneid.com (Christian Schneider) Am 21.04.2022 um 16:09 schrieb Rowan Tommins : > All of that, and the "consistency" in the title of your RFC, is a = complete > distraction from the real questions: >=20 > 1) given a null input, and a non-nullable parameter, what should the > run-time do? > 2) what is the best way to help users update their code to be = compatible > with that new behaviour? You are leaving out option 3 (which is not part of the RFC but should = still be on the table IMHO): 3) Leave the behavior but change the parameter definition to nullable to = match the implementation. > For instance, $search =3D ($_GET['q'] ?? ''); is both shorter and = clearer than > $search =3D ($_GET['q'] ?? NULL); Your version is lossy as you cannot distinguish between "empty query" = and "no query was submitted" any longer. While this is normally easily fixed checking other flags it needs = additional work and cannot be done with a simple search and replace. Regards, - Chris