Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:117177 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 78616 invoked from network); 1 Mar 2022 11:34:24 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 1 Mar 2022 11:34:24 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id AFA3E18053A for ; Tue, 1 Mar 2022 04:55:37 -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: Error (Cannot connect to unix socket '/var/run/clamav/clamd.ctl': connect: Connection refused) X-Envelope-From: Received: from mail-lj1-f178.google.com (mail-lj1-f178.google.com [209.85.208.178]) (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 ; Tue, 1 Mar 2022 04:55:37 -0800 (PST) Received: by mail-lj1-f178.google.com with SMTP id u11so21757158lju.4 for ; Tue, 01 Mar 2022 04:55:37 -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=cLM5bUt9HFACQca5KOPM1qnNfhlYcC9WpRcr+scvK3Y=; b=WtFTuOUHGoRGa83dW/IpQOvPRwtoz4iQbCgXA25/CO+DiBTLrEqaIKeBjcSZ5ZpF/D NxEhWSnnJsOfD2wZjwFr6NnQm+PaZ5D3aXURzNlW21u8WCArnTFzu0AXVdMRwxZ/IyGV QjL39HSBLuQWHMvDb+MYalWZBJ+WBtJ8aLlwU= 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=cLM5bUt9HFACQca5KOPM1qnNfhlYcC9WpRcr+scvK3Y=; b=QlznC1lm6uEeWmjukosltsk/s63YIGLa2Trs17XPxn58qFsKFj0PuW78uPKDwRzkaJ cAdeD+XzwxEVWP+HvbtZKlyMwWlSrp+/+TQSvFNhplkWUz4za25KpVRJtt3T8m6imCai FmItu5lXBbN338t08s5wrVcKsY5PbAibYMApuV/YrCn+mUvNChV//eHJ8kDurGmKN12z kYY/BIgzTo/V86EReg5HUMc/n7NmwFaA8muHwaotz/tUeE7pENaQQ0gInPVV2kbp1iBl 1MnQZC02NJyxAzomT+dakYUPQXAIO345s2/OvdO2J7NRzW6qAAoIO5peaotvDYCqjIfZ hPHw== X-Gm-Message-State: AOAM531pKPriBdieT0G468tLOOujgmmyUDPRjOtGTIBs3gsS83mjWHBP R+IMvflIbZKJ4pAyUn2hSody/QM+Amb2kVyPsChajXY3bGt5tkWR X-Google-Smtp-Source: ABdhPJxtiEkdxFIY/rVbymiLfq02aaA3kphn/YB7mHXCx3JCGqZpoq48G1YdN+5fpdXfPdg72JGP8dGAmj69xQKSbbo= X-Received: by 2002:a2e:8198:0:b0:246:e7d:45d2 with SMTP id e24-20020a2e8198000000b002460e7d45d2mr17093724ljg.495.1646139335471; Tue, 01 Mar 2022 04:55:35 -0800 (PST) MIME-Version: 1.0 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> <621dec08.1c69fb81.23ab4.ce84SMTPIN_ADDED_MISSING@mx.google.com> In-Reply-To: <621dec08.1c69fb81.23ab4.ce84SMTPIN_ADDED_MISSING@mx.google.com> Date: Tue, 1 Mar 2022 12:55:22 +0000 Message-ID: To: Mark Randall Cc: internals@lists.php.net Content-Type: multipart/alternative; boundary="000000000000578bf205d927ae57" Subject: Re: [PHP-DEV] Allowing NULL for some internal functions From: craig@craigfrancis.co.uk (Craig Francis) --000000000000578bf205d927ae57 Content-Type: text/plain; charset="UTF-8" On Tue, 1 Mar 2022 at 09:48, Mark Randall wrote: > You see a problem, but rather than trying to fix the underlying cause, > you're proposing making changes at other layers to accommodate the side > effects of the original problem. > > That is practically the definition of a hack. > No, there is an inconsistency which leads to a backwards compatibility issue, and I'm trying to fix it. I'm sorry I'm clearly no good at explaining this... maybe I should try bullet points... I am not trying undo the intent of the original RFC (constancy is good). PHP has type coercion when not using `strict_types=1`; this is a feature, one you might not like, but many do. Coercion works for string/int/float/bool, *and* NULL. It even has it's own clear paragraphs explaining this in the manual: "null is always converted to an empty string." "null is always converted to zero (0)." "the following values are considered false ... NULL" Not only does this happen with function parameters, but also non-strict comparison operators, e.g. `($nullable == '')` is true for NULL. It was only user-defined function parameters with a specified type (introduced in PHP 7.0) that broke that consistency, and only for NULL, because the other types continued to be coerced, it was just NULL that was the oddity. This is important because NULL is used a lot, as both a distinct value, and as a convention as the default for parameters (ref setcookie). And internal functions have always accepted NULL. As of 8.1, the inconstancy between user-defined vs internal functions was addressed (good, I dislike consistencies), but the details were barely discussed (one message, from Craig Duncan): https://externals.io/message/112327 I'm trying to avoid an upgrade problem for PHP 9.0. I want to keeping the strict checks in place for those who use `strict_types=1` (so Mark, you would not be affected by this, as I assume you use `strict_types=1` for everything). And note the complete lack of tools to fix this issue, and how many instances would need to be changed. Unless you're planning to force `strict_types=1` on everyone (Type Errors for all, remove all type coercion), this inconstancy does not make any sense. Craig --000000000000578bf205d927ae57--