Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:117525 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 59207 invoked from network); 13 Apr 2022 18:12:52 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 13 Apr 2022 18:12:52 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id C9380180381 for ; Wed, 13 Apr 2022 12:44:55 -0700 (PDT) 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.1 required=5.0 tests=BAYES_00,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,T_SCC_BODY_TEXT_LINE 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-f45.google.com (mail-lf1-f45.google.com [209.85.167.45]) (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, 13 Apr 2022 12:44:54 -0700 (PDT) Received: by mail-lf1-f45.google.com with SMTP id b21so5413745lfb.5 for ; Wed, 13 Apr 2022 12:44:54 -0700 (PDT) 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=vmpg8fVHXxYuBNj5Qeis7Ym51Ay5PE/t4gfD/YIaa3c=; b=AHeNFri1X83omGcNCzQeTS7BuetKOuh7sM9c1K1C2D4SPDR1QywKfdnLAtl6OHpons i+svt8UxxZsJwpPVErssSPWBNHe/Oztn3AHZdNGZUvtIzbe8ynk+LPZL0TfBqpovpE0o QQ3SxfkSL4NZCGicesyVXsG1OaQjH6TichLRc= 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=vmpg8fVHXxYuBNj5Qeis7Ym51Ay5PE/t4gfD/YIaa3c=; b=YECsXUvgcEVdVa60q3H3ANsdt2U+PIW2JoHKR/4gSX7pInc+QaNwBxLNYnMUcbCNyp eWyQY1SfBu28NbxS42ixS0LlWpFuVYS4IrR/wkAyjNTt6iFd0wXYhe6eLza4y7HtZ8td Dh79c4j6f6+JMJtOzgPcK1XL+9RxbMcPEqA6cJUbhCa3hQ8fgWqGs+p2PnqsaYc+V3rz saUTGEk0dzld3yfdmuqrgfJ3SsmWqXotznltp4VBfkyzeGR3S/E3a8k6k4Y7QXNBLA7n bjVXXbNCWolRwKyMpijbZmbee8csH/9Qt3su2iL9ZBl8zrlhfxuUYj9OgAAjnaES9Dfq PKDw== X-Gm-Message-State: AOAM530g8HmcgJZBW1pYFhM/7C+B2KQRfXqYxizjwjh9bn6/FU96mYKz /rVu9xt5MLBDN0cHr0x0wNFoULsgJQxZ/IOIgwhaLg== X-Google-Smtp-Source: ABdhPJxpofiFHdRDHjQEtuEVc1Bci+o4wTqOe6y8fEaTWQmSD35YOUj0IccbQaVJHsQ94XKRjQGaPqc8EPyN/AbLm0M= X-Received: by 2002:a05:6512:ac4:b0:46b:88a0:e462 with SMTP id n4-20020a0565120ac400b0046b88a0e462mr18350760lfu.472.1649879093166; Wed, 13 Apr 2022 12:44:53 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Wed, 13 Apr 2022 20:43:00 +0100 Message-ID: To: "G. P. B." Cc: PHP internals Content-Type: multipart/alternative; boundary="00000000000045611405dc8e69ad" Subject: Re: [PHP-DEV] NULL Coercion Consistency From: craig@craigfrancis.co.uk (Craig Francis) --00000000000045611405dc8e69ad Content-Type: text/plain; charset="UTF-8" https://wiki.php.net/rfc/null_coercion_consistency On Wed, 13 Apr 2022 at 15:15, G. P. B. wrote: > I've spent a large amount of time making coercive typing mode more > sensible and aligning the behaviour as close to reasonably possible with > strict_types so that the possibility of dropping strict_types all together > wouldn't be outrageous. > I've written about this elsewhere and on this list already but main points > are located here: https://github.com/Girgias/unify-typing-modes-rfc > Thank you George, I do appreciate your work on this, I agree with pretty much everything you have written, and I really do want PHP to move in that direction. The *only* thing I disagree with is NULL coercion, because it has worked perfectly well for years, and is used so often. Userland scalar types, however they would have been introduced, did not > include coercion from NULL for *very* good reasons. > Wanting to change this behaviour needs more justification than a paragraph > in docs, as the docs should reflect the reality of the implementation. > Some people see NULL as an invalid value, which can sometimes be useful in a `strict_types=1` environment, but that's the only "good reason" I can find... it's why I changed my mind about making some parameters nullable, and took a different approach with this RFC. But most developers do not use NULL like that, and that's why it's passed so often to the ~335 function parameters I've noted (most of them are on the list because they realistically receive user values, which can be NULL in most frameworks). The second aspect is the general consensus that internals and userland > should behave identically. > Yep, they really should... it's why I said we "Must keep the spirit of the original RFC, and keep user-defined and internal functions consistent". Moreover, the fact that we are deprecating this and not just changing the > behaviour from one version to another is that we do recognize PHP > developers use NULL in this way, and we are giving them advance notice of > the change. > Also a deprecation notice should, IMHO, never be promoted to an exception. > Unfortunately deprecation notices are being ignored (as noted in my RFC, with examples on how); and there is the intention to use Type Error Exceptions in 9.0 (the thing I'm trying to avoid). I'm approaching this from a security point of view - the last thing I want to do in ~5 years is auditing code/systems where they have stuck with 8.x because it's too hard to upgrade. There are behaviours of PHP that will probably never be "fixable", but this > should not prevent us from improving the aspects we can. > And if we only focused on how developers use PHP we would still have > register globals, magic quotes, etc. > I want the language to be better as well, and I was *very* glad to see the back of Register Globals and Magic Quotes (I know they were a pain to remove, but it was well justified, as they caused so many problems). Clearly it seems you won't listen to why these changes were made and want > to reverse course, therefore good luck convincing enough people to accept > such an RFC. > I have been listening/reading (it's why I've taken about 2 hours to read what you have written, and reply). I have also been discussing this with different people (on and off list)... unlike the original RFC discussion, where it was only Craig Duncan that mentioned this issue: https://externals.io/message/112327#112531 And it's because I've been listening to people that I changed my mind, and created this new RFC (as noted above). I think I've said all there is to say and won't interact further with any > such proposals. > That's a shame, as I'd like to discuss solutions to this problem you would be happy with. Craig --00000000000045611405dc8e69ad--