Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:117166 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 10298 invoked from network); 28 Feb 2022 16:21:28 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 28 Feb 2022 16:21:28 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id B621B1804E3 for ; Mon, 28 Feb 2022 09:42:29 -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.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS29838 64.147.123.0/24 X-Spam-Virus: No X-Envelope-From: Received: from wout5-smtp.messagingengine.com (wout5-smtp.messagingengine.com [64.147.123.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)) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Mon, 28 Feb 2022 09:42:29 -0800 (PST) Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.west.internal (Postfix) with ESMTP id A4A91320076F for ; Mon, 28 Feb 2022 12:42:28 -0500 (EST) Received: from imap43 ([10.202.2.93]) by compute5.internal (MEProxy); Mon, 28 Feb 2022 12:42:28 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=3wCNM7ovn97TXPD4h R78DKagTlhOrOBKawMqsg4KljY=; b=Nu8BI/HCGKATsMgDNqP7ACKFX9bSLfYdi FIJ/bISCsq/9aj47z+iwAsrW1pDr5+SbPZo8wW6FmGHyUwAa3+N1PxU4psHMUciS CIKxDMkzFkPx81qB1jrZ/uo1BL7ceyhSILUIX+fSyZP1NbLzvkZ4lrb7XqFL4b3E cHJIZJRGnw1QVMZANole1AUJzpBZJptMLfufu16iz5/WV7I5XO5oUCTSEA76KJ7Q EyIUvkNjT0J3wAdUv5ni9UmI6FzqQH/k0XPp2w3MCOnxb7JVXnoGXocP0fjVben5 J2GeELBUG++aGdzvlk4qIf+CE9C7lobnEcF5hRFunWu82KnrZK8MQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvvddruddttddguddtfecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefofgggkfgjfhffhffvufgtsehttdertderredtnecuhfhrohhmpedfnfgr rhhrhicuifgrrhhfihgvlhgufdcuoehlrghrrhihsehgrghrfhhivghlughtvggthhdrtg homheqnecuggftrfgrthhtvghrnhepgeelgfekudeivddvteffueejffdthfejieevhefg ffekudevkedtvdelvddvffefnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpe hmrghilhhfrhhomheplhgrrhhrhiesghgrrhhfihgvlhguthgvtghhrdgtohhm X-ME-Proxy: Received: by mailuser.nyi.internal (Postfix, from userid 501) id B3113AC0E9A; Mon, 28 Feb 2022 12:42:27 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.5.0-alpha0-4778-g14fba9972e-fm-20220217.001-g14fba997 Mime-Version: 1.0 Message-ID: <69642616-72b7-44fe-97a7-27ae03bc8fce@www.fastmail.com> In-Reply-To: References: <983552d8-11f1-b5bc-fb82-148347982fda@gmx.de> <5494eaa7-2fa6-8364-9683-a2c8c9789d81@gmail.com> Date: Mon, 28 Feb 2022 11:42:06 -0600 To: "php internals" Content-Type: text/plain Subject: Re: [PHP-DEV] Allowing NULL for some internal functions From: larry@garfieldtech.com ("Larry Garfield") On Mon, Feb 28, 2022, at 11:35 AM, Guilliam Xavier wrote: > On Mon, Feb 28, 2022 at 5:41 PM Dik Takken wrote: > >> >> In my view, consistency between internal and userland functions brings a >> lot of value, and not only for the language itself. As soon as internal >> and userland become fully consistent it will become a lot easier to >> write "internal" functions in PHP rather than C. Not only will that make >> developing the standard library easier, it may also make the optimizer >> and JIT compiler more effective. The more consistency the better. >> > > Yes, and we see two possible ways to make them consistent w.r.t. handling > of null argument passed into scalar parameter: > > 1. implicit coercion by default, error with strict_types=1 > 2. error (independent of strict_types) > > AFAIK, internal functions have been doing 1 since like forever, but PHP 7.0 > chose 2 for userland functions when introducing scalar parameter type > declarations (see my previous message for history) and PHP 8.1 continued in > that direction by deprecating 1 for internal functions (and planning to > change them to 2 in PHP 9.0). > Call me devil's advocate, but is it too late to discuss revisiting past > decisions and consider changing direction towards 1 for userland functions > (esp. in implications of BC impact)? Under absolutely no circumstances should parameters become implicitly nullable. That way lies madness. And yes, coercing null to a magic zero-value is a form of implicit nullability. Absolutely not, under any circumstances. Bringing internal functions into line with user-space was the correct move. There may be internals functions that make sense to be nullable on their own right, on a case by case basis. We can evaluate that case by case. --Larry Garfield