Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:117000 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 68260 invoked from network); 7 Feb 2022 15:24:11 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 7 Feb 2022 15:24:11 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 58339180539 for ; Mon, 7 Feb 2022 08:39:56 -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=-0.7 required=5.0 tests=BAYES_05,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,HTML_MESSAGE,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-lf1-f42.google.com (mail-lf1-f42.google.com [209.85.167.42]) (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 08:39:55 -0800 (PST) Received: by mail-lf1-f42.google.com with SMTP id u6so27949581lfm.10 for ; Mon, 07 Feb 2022 08:39:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=craigfrancis.co.uk; s=default; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=SgZ6KcjNhkkqAevyqngfP+x3l+mlI43P8ncrpzhUWeQ=; b=P8HUBkOpVFPhVmE4iBQOt00jTgsXyzPBb7AWJxuTAwKd5Hz4yJMyb9Dau129U5UyE/ nLHf932d5bEdCsha4jMg7XnJ3NNsj50EySYDj+tsFZOxU1Uxo3o5ZjJfMmWqo+9zD5ev anqybqlK6liLV1+R3cNRLsLROvXWMDVr5+p3U= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=SgZ6KcjNhkkqAevyqngfP+x3l+mlI43P8ncrpzhUWeQ=; b=MmuETtxAekWQhF5oi0dc98HUtEK+KHRB5W5iug5R/XKz4I0z540P6KGGjKGgqIs5mx ZdQgeI1E5e9hbuZLpeJ2qhY0LPRaqFLcjSPRi4JrtoY+cgi4y746UvlrkAPm93xbh4yl tBYROTNwUEZnKrJfDW8U8L80rqCHykD9IEpFw8u9e/Yoo9EbbCMfJWxhrq4L8wXZjKP0 t8lJwSbN0E7ZUFZ7fS+7NtSIITfBH0H0Nn8Ick9LteF0RScKmJY+Cn9nk4RW1Zvx+vrq k5VeRQZBsEbltdfNqnLuXPlGf8EaFars0lK6Q/HECd4vtfm6nP9BG7LLFVS2aUvKC2Dl df5w== X-Gm-Message-State: AOAM532yknWUYWQTcjSwZe7KJ3QR3NWGqMoVJ7XVoppaC4TBXggRVJoh Z16VNY1JQQe5KBxKLQJfwCLPcG81AqxHJRdZZvNiq0gBPak= X-Google-Smtp-Source: ABdhPJyLuafP4aFlc4slQN22ayjKSKBoLuk67CISCXpfJlZ/hW1jXvm3jILiTxVlyn8yKIm45ro5X1+GGVQEVqe8yEA= X-Received: by 2002:ac2:530a:: with SMTP id c10mr254919lfh.472.1644251992971; Mon, 07 Feb 2022 08:39:52 -0800 (PST) MIME-Version: 1.0 References: <7CCE6061-F5BD-4C10-8BD1-F5A2A994D5F6@cschneid.com> <082301d9-2e69-48ce-a85e-a6e2a57e3f9e@www.fastmail.com> In-Reply-To: <082301d9-2e69-48ce-a85e-a6e2a57e3f9e@www.fastmail.com> Date: Mon, 7 Feb 2022 16:39:42 +0000 Message-ID: To: Larry Garfield Cc: php internals Content-Type: multipart/alternative; boundary="000000000000f66e7205d7703fa9" Subject: Re: [PHP-DEV] Allowing NULL for some internal functions From: craig@craigfrancis.co.uk (Craig Francis) --000000000000f66e7205d7703fa9 Content-Type: text/plain; charset="UTF-8" On Mon, 7 Feb 2022 at 15:15, Larry Garfield wrote: > The goal is consistency, so keep it consistent. I'd be happy with that. The only reason I've taken this approach is for developers using type checking to identify certain mistakes in their code (which can be useful); so I wanted to keep them happy by not changing any of the stricter "string only" arguments... that's why my patch silently makes PHP a bit more tolerant of NULL for the projects that aren't using `strict_types`... and, as noted before, I'm not suggesting all arguments - e.g. `NULL` is quite likely a bug for the `$characters` argument in `trim()`, and PHP probably should complain, even though an empty string does not. If there's an argument to be made to rewiden a type to include null, make > that case and have that debate on a function by function basis. I'm fine with that, but I worry people are underestimating the size of the problem (having a debate on each one would take a long time). I've put together my proposed list, it took a few days, and a lot of thought: https://github.com/craigfrancis/php-allow-null-rfc/blob/main/functions-change.md I've asked for suggestions and pull requests a few times, and the best I've got is `$path`/`$domain` for `setcookie()` (I disagree because `NULL` is often used for those arguments, so that `$secure` and `$httponly` can be set to true). At this point I think people should be suggesting why any of these function arguments should trigger a Fatal Error in PHP 9 if they receive NULL.. again, happy to discuss here; or off-list via email, video call, etc (thankfully, for my own mental health, the off-list messages have been positive)... or you can make suggestions on the repo: https://github.com/craigfrancis/php-allow-null-rfc/issues https://github.com/craigfrancis/php-allow-null-rfc/pulls --000000000000f66e7205d7703fa9--