Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:117193 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 56693 invoked from network); 2 Mar 2022 11:04:51 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 2 Mar 2022 11:04:51 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 9CAD5180539 for ; Wed, 2 Mar 2022 04:26:19 -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.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,NICE_REPLY_A, 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: Error (Cannot connect to unix socket '/var/run/clamav/clamd.ctl': connect: Connection refused) X-Envelope-From: Received: from mail-ed1-f54.google.com (mail-ed1-f54.google.com [209.85.208.54]) (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 ; Wed, 2 Mar 2022 04:26:19 -0800 (PST) Received: by mail-ed1-f54.google.com with SMTP id s1so1978585edd.13 for ; Wed, 02 Mar 2022 04:26:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:date:mime-version:user-agent:subject:content-language:to :references:from:in-reply-to:content-transfer-encoding; bh=GGsbCyvxrZ3N43Gua+8IRVSGrYwtDHtKfvmKwezc7p0=; b=gPJamn5qg/Hzvmd8ahT8VMSCe4841mMzLNgHLYPO+OEGnO8vuQ3zZAf2a2I84FLjXH po7iuSAB0fP1Gf4lzwRqK+wfBMjDl42B4BEI/zYsltRqnMs6dIUhzW1oyyN9rZ+ssJYd TrciFneu56vyb6NR6JPnZdUExBiDwipx2XSaAjgX3/z/qvKOFcyrXsJq9cV+XefiDdam hVX7sK3uEyC8Q2htEzC6w3zDmcwvhDy7nYpvd7M+7EYYtS3svw8D5/eUzl0kItkvxsup jI4dnpcXoYB+hqxgaBcxJrficTd5nBRvmw3dKVT6nqhoeMvHautxro0/U7M2VLwMLo5M 3vOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:references:from:in-reply-to :content-transfer-encoding; bh=GGsbCyvxrZ3N43Gua+8IRVSGrYwtDHtKfvmKwezc7p0=; b=Ung5lQRYNa9PgFF2Z3l7ozcR5iuNWvh2TA8p2Mm5/BUR6QqcMHKu5mglukx4us/lmF QWffDji5nMzKi59PyCNYDxtta3kF0Ffhs2EjRSg+3T31EroIfwJ7oAmuN2EXgMBEGzhN CWYibt/UFzZqQ5K3p6fAGJt1m+ATwy/+8psuSU1kbmJGofcqExKYpnypSrzGLWkuaZr3 5ei1FQPiNMdzjWzopqZ7ONLcDw844ASaB1cf2xBT++0y6QiFweSH3RyVlbK66X6ZZ78D T0dieYXfOkLlz4mh3HSx5/aC8LZUnlOe9wK4xPGK6QpiUwyEbz6MoHK7ffVvXRHP0v/s 73dA== X-Gm-Message-State: AOAM530ISo+oZAny0CcYh1sW51OUt1y5M0OKtrYSwdRZMqTCvR9LEG6f VbxYZP7/T4qSoyN6IeKYgtVcQWCLiuU= X-Google-Smtp-Source: ABdhPJzWZO9pRwKmQfnpQ5Uk26oIKjIdrVx/T4tJqQQMKwJd1O9OGNSAJcJWEkv/9f7G2dldH3I2zA== X-Received: by 2002:a05:6402:11cd:b0:410:d432:2e30 with SMTP id j13-20020a05640211cd00b00410d4322e30mr29059334edw.119.1646223977992; Wed, 02 Mar 2022 04:26:17 -0800 (PST) Received: from ?IPV6:2001:983:6fc5:1:5400:d9f2:b79:86cf? ([2001:983:6fc5:1:5400:d9f2:b79:86cf]) by smtp.gmail.com with ESMTPSA id s15-20020a170906c30f00b006da81e2bd21sm29544ejz.172.2022.03.02.04.26.17 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 02 Mar 2022 04:26:17 -0800 (PST) Message-ID: <4bff3f23-a3ec-4416-f44e-1f4f5d7e0caa@gmail.com> Date: Wed, 2 Mar 2022 13:26:16 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.6.1 Content-Language: en-US To: internals@lists.php.net References: <983552d8-11f1-b5bc-fb82-148347982fda@gmx.de> <5494eaa7-2fa6-8364-9683-a2c8c9789d81@gmail.com> <69642616-72b7-44fe-97a7-27ae03bc8fce@www.fastmail.com> <7fbed755-42e2-d023-285f-39863a97f297@gmx.de> <3665C848-B4C3-4528-AEFA-02C868748AA8@cschneid.com> <0b5bc29d-3814-0e1d-b94a-47790019c778@gmx.de> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Allowing NULL for some internal functions From: dik.takken@gmail.com (Dik Takken) On 01-03-2022 19:10, Craig Francis wrote: > > I'm pretty confident the best solution is to keep all parameter types the > same (I could argue that some parameters could do with a "cannot be empty" > exception, to reject NULL and an Empty String, but that would be a > different RFC)... and anyone using `strict_types` will still have a Type > Error when they pass a value of the wrong type to these parameters... the > *only* change is for those not using `strict_types`, for NULL to still be > coerced to a string/int/float/bool, as it always has been for internal > functions... and I think this can be done to user functions as well, as > developers not using strict_types won't have cared about this before. > > Craig > Hi Craig, So, to get this crystal clear, this is my understanding of what you are proposing for passing null to a non-nullable function parameter (hopefully my ASCII art will come through ok): which | strict_types | PHP 8.0 | PHP 8.1 | PHP 9 ----------|---------------|------------|------------|---------- user | 1 | TypeError | TypeError | TypeError internal | 1 | TypeError | TypeError | TypeError user | 0 | TypeError | TypeError | coerced internal | 0 | coerced | Deprecated | coerced Is this correct? Regards, Dik Takken