Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:117527 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 93330 invoked from network); 14 Apr 2022 06:38:56 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 14 Apr 2022 06:38:56 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 73EAF1804AB for ; Thu, 14 Apr 2022 01:11:05 -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-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 ; Thu, 14 Apr 2022 01:11:04 -0700 (PDT) Received: by mail-lj1-f178.google.com with SMTP id o16so5070570ljp.3 for ; Thu, 14 Apr 2022 01:11:04 -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=5Uyvral7vha8VxgU0pIcdDJauOUBEUqvjIOwpQ8EXU8=; b=Yn3yX3roy3Mry/uBj6i7kbvdp5uqK+XIePuqabAtjheYkWWt0uYoC07ounVZPeMzGn 4OCWZoXGFIkmUH5BYf9rhgDAsRaJ3d3Oe9I00xAH7GZe4EVVLk0Zlb8mTnCtic/sXyxB bcfGX/jAbaA/nc+kpnYMQ5v6tNsRAvlwGlkXM= 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=5Uyvral7vha8VxgU0pIcdDJauOUBEUqvjIOwpQ8EXU8=; b=n8wCn1hdcHj2u+IGy3vtkREvKB7H9/3HvCmewKM6to3q9qAubSGmLAZSaQJVuu2uJb rdDl9R0213YR9tFksAVUpSQ0108ifvihOKAQeS8kl+WGidAekYaGsfheuCIebHS2kUJ5 CFOXPA6QIIIbccl66uZHuWpyIUGSwiQMOHXAHsd2tfFgfly8B67Wj3CetROjwczkBHJK QJQMo869Bl9KYoYKzxF4NS0B+7MfpNfruMUu4Yd8F7hPE0wu/3aygBvJebicx4UPfxd7 Gk0UzKtvsREkmbSQsFkxMnegm9tDMq4xA1BQZR7t6yviZkDydwHbRC4rdMx6X9w/v9rO C6JQ== X-Gm-Message-State: AOAM530PzoC1QvC2gntSakoi8Vn3q9no02U5zuTEfyFjVeLfSZFUiSfQ y7SHge/aGpMk3ZgXAZmN38EGj2tWh45scNkDs3j0tg== X-Google-Smtp-Source: ABdhPJy3Xb11Dp5n4u97K7cgl0oXHeiKaVD/TUCKkEWkxLIeaQtVA3pStRnrtvE3Q1Lj5l6VsUvMKJBSMEDVM1Zvr8o= X-Received: by 2002:a2e:8182:0:b0:24b:69e5:8dc9 with SMTP id e2-20020a2e8182000000b0024b69e58dc9mr902214ljg.27.1649923861996; Thu, 14 Apr 2022 01:11:01 -0700 (PDT) MIME-Version: 1.0 References: <2035695b-b6b5-5982-a5ea-e85693e1f71f@gmx.net> In-Reply-To: <2035695b-b6b5-5982-a5ea-e85693e1f71f@gmx.net> Date: Thu, 14 Apr 2022 09:10:50 +0100 Message-ID: To: Andreas Leathley Cc: PHP Developers Mailing List Content-Type: multipart/alternative; boundary="000000000000b37dfd05dc98d59d" Subject: Re: [PHP-DEV] NULL Coercion Consistency From: craig@craigfrancis.co.uk (Craig Francis) --000000000000b37dfd05dc98d59d Content-Type: text/plain; charset="UTF-8" On Wed, 13 Apr 2022 at 20:08, Andreas Leathley wrote: > Mentioning the documentation as a reason to be "consistent" (which comes > up again and again in your arguments with this RFC) just seems like a > bogus reason to me. It is nitpicking about specific sentences in the > documentation without refering to the surrounding context. It would be > nicer to argue according to real technical arguments instead of > arguments about sentences taken out of context in the documentation. > I don't, do I? I've checked multiple times, and I only use the documentation to note how NULL coercion works. I'm using the word "consistent" to be "consistent with scalar types"... as in, a string/int/float/bool can be coerced, but NULL coercion has now been deprecated in some cases, as shown with the examples. > "Most developers do not share that view". I find statements such as > these as a tall order - did you interview the majority of developers > around the world? Are you suggesting you are talking as a representative > of a large population of PHP developers? How do you think you got such a > role? My intro says "Roughly 85% scripts do not use strict_types=1", and "Roughly 33% of developers use static analysis" (source of numbers noted in my RFC)... while that does not guarantee anything, it's a fairly good indication that most developers do not care about types (in regards to coercion), or specifically, how you "see null as a real type". As an aside, I would like to include more stats (maybe WordPress install numbers?), but I couldn't think of any which were easy to source (ref reliability), or be that useful to the discussion. I would prefer some humility and not assume you are an elected > leader of an underrepresented group of developers and even knowing the > intention behind their code. > I'm simply describing the situation, and I have suggested two ways to avoid the upgrade problems (the suggestion to update some arguments to be nullable has been rejected by written feedback, and via my questionnaire). "NULL has been passed to these functions, since, well, forever" - this > also goes for wrong values being passed to functions since forever > leading to security issues and bugs. I say in the RFC that "Arrays, Resources, and Objects (without __toString()) cannot be coerced (for fairly obvious reasons)". For example `htmlspecialchars(array())` will, as of 8.0, throw a Type Error (and a warning before), that does represent a bug (it should not happen), and I'm very happy with that situation. But NULL coercion is different, it has worked well for years, and it is used a lot (see the examples in my RFC). Craig --000000000000b37dfd05dc98d59d--