Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:112793 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 26792 invoked from network); 7 Jan 2021 12:08:49 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 7 Jan 2021 12:08:49 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 5443E1804F3 for ; Thu, 7 Jan 2021 03:45:31 -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.2 required=5.0 tests=BAYES_40,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,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-Virus: No X-Envelope-From: Received: from mail-lf1-f53.google.com (mail-lf1-f53.google.com [209.85.167.53]) (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, 7 Jan 2021 03:45:30 -0800 (PST) Received: by mail-lf1-f53.google.com with SMTP id o10so2963977lfl.13 for ; Thu, 07 Jan 2021 03:45:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=umt1R+OgveS8MmPWwCpvlAYv5dexhnWONhazBJQ6+hE=; b=MyTTAA9MRB42vB4nSkO306EQFvbfeZruvwpPyEoYZ5c259EPJsi6RFdVUuwKJQHkiQ 7YX+10tewqrp4BtGnxY/QEaxgW88fTvBBLKRIu1ADYV7B4tgIQjX3vJDouKSZ5szZ/y/ 0AnGyRIXOQbXXt1vL1wIw35jBu+6fkucUICgI1Q6iIwxf4V6+bXxQQg8YQZAgrxcNx+U j+wJsDhB4TYLk1DPVp+i68m1HNFaXOkGRVZQp/8Rt9wK30OSiCNwQ7FCNPTXFBawT9Fk haGNRvISP4t3tTDHmg6QrHN7yljvU0EGP+p6vNMbDAdRetTkA1ixJz3L/wkNL6mxVWva AEkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=umt1R+OgveS8MmPWwCpvlAYv5dexhnWONhazBJQ6+hE=; b=QRGYDiGn9mt+n7ZnoNgOXOSgca/hFsk0qoYUG2rCbWY2f5IC1sCVKcrjGKjyrlaOel tAMsYEpoQaPG47+7aTIwK9YxiiyPskLq4AqHbcQw0Qeg6Vtaz+E+7hgNlRDhIYkbwyCy usy6GjxvmT/PG9+/D46KAZmUEch+IHl14HpqkRLc6cZvCO+j9c1RQb/44x3ZE7zbCcv7 lGSYHanjGzZ+mXZ631+B0CoYsOtQyc3BbHJkmJQw6DV8qg+dkp0n9/b1N+UD4PHvMiZq bNL5HbChY5u5+vo0Qoq2J7rHBZMA+Uxa1ze3gBFvwD7D+DhltnW0u3KQP2mLfNsTN38+ mjkQ== X-Gm-Message-State: AOAM532ls5vEorQ0AtfLcRDK9wULnFm7+6KxEoWNPg934zJ6q4jBoKb/ /1r3rkNrgXE8xCTAFsorAccueL1aZjI3CXFp2ULmC8YWGkE= X-Google-Smtp-Source: ABdhPJxgHK6Q16di06HyYAXo6+13wCuFOVMfIPhzYVAgmX89eXiYUV/wmvdZVwERF4ZGnoa6CLaR0P7aMDChWfWNXpk= X-Received: by 2002:a19:ed6:: with SMTP id 205mr4187071lfo.159.1610019927638; Thu, 07 Jan 2021 03:45:27 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: Date: Thu, 7 Jan 2021 12:45:11 +0100 Message-ID: To: Craig Duncan Cc: PHP internals Content-Type: multipart/alternative; boundary="000000000000de5aa105b84df9f7" Subject: Re: [PHP-DEV] [RFC] Deprecate passing null to non-nullable arguments of internal functions From: nikita.ppv@gmail.com (Nikita Popov) --000000000000de5aa105b84df9f7 Content-Type: text/plain; charset="UTF-8" On Wed, Dec 16, 2020 at 10:50 PM Craig Duncan wrote: > While making internal functions treat non-nullable types consistently with > userland is an absolute win, > I do wonder if it should be done simultaneously with changing some > functions > to formally accept nulls. > PHP 8 made quite a few function/method arguments nullable to fix various behavior consistency issues. That said... I'm thinking back to all the pain caused when *count() *starting raising a > warning for null values. > We saw a lot of code that passed undeclared variables to *count()* > and I can imagine people writing similar code with something like > *strlen()* > I don't think that making the argument of strlen() nullable is in any way appropriate. This is a case where people will just have to fix their code. I do think we can relax certain type requirements on a case by case basis (e.g. the fact that ini_set requires a string rather than any scalar value seems unnecessarily pedantic), this just isn't one of those cases. Generally making arguments nullable mostly applies to arguments that are optional. Regards, Nikita --000000000000de5aa105b84df9f7--