Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:116990 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 34358 invoked from network); 7 Feb 2022 08:19:00 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 7 Feb 2022 08:19:00 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 512F7180539 for ; Mon, 7 Feb 2022 01:34:41 -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.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_NONE 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 ; Mon, 7 Feb 2022 01:34:40 -0800 (PST) Received: from smtpclient.apple (unknown [IPv6:2a02:1210:2ea4:cf00:e073:c801:a295:2e80]) (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 76B191516029 for ; Mon, 7 Feb 2022 10:34:38 +0100 (CET) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 15.0 \(3693.60.0.1.1\)) Date: Mon, 7 Feb 2022 10:34:38 +0100 References: To: internals In-Reply-To: Message-ID: <7CCE6061-F5BD-4C10-8BD1-F5A2A994D5F6@cschneid.com> X-Mailer: Apple Mail (2.3693.60.0.1.1) Subject: Re: [PHP-DEV] Allowing NULL for some internal functions From: cschneid@cschneid.com (Christian Schneider) Am 07.02.2022 um 09:35 schrieb Mark Randall : > On 07/02/2022 01:27, Craig Francis wrote: >> I know one person simply said this was a "terribl > idea", but I'm = still >> waiting to hear any details on why. >=20 > I understand your motivations in proposing them, but to my mind it = goes against the direction that PHP is developing, which I think is the = right one, where errors and likely errors result in stopping execution = rather than allowing it continue, potentially silently (dependent on = error handling settings). I think some proposals for PHP are going too far with strictness so I = very much like Crag's RFC. > If a parameter expects a string, that is what it should be given, and = its the callers' responsibility to ensure that is the case. If they fail = to do so then it's an error just like any other. The decision to define e.g. strlen() as strlen(string $string) instead = of strlen(?string $string) was arbitrary and I for one would prefer the = loose definition. I'm confident that any real world example would abort at an early enough = stage to catch errors in your program, without something as basic as = strlen() having to do the job while adding complexity for something as = simple as "if (strlen($x)) ..". > IMHO reverting to "If it's a null we'll just pretend its a string" is = contrary to how the language should be progressing. > It sucks that it was ever allowed in the first place. I think we agree to disagree here ;-) > PHP has a long history of making descisions to try to make things = 'just work', and if history teaches us anything, its that we inevitably = come to regret these descisions down the line. PHP has a long history of being a concise, pragmatic language and there = are many who do not regret this at all. Finding the right balance is key here. - Chris