Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:117696 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 48002 invoked from network); 8 May 2022 09:10:21 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 8 May 2022 09:10:21 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 7F45418005D for ; Sun, 8 May 2022 03:48:34 -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,FREEMAIL_FROM,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-yw1-f177.google.com (mail-yw1-f177.google.com [209.85.128.177]) (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 ; Sun, 8 May 2022 03:48:34 -0700 (PDT) Received: by mail-yw1-f177.google.com with SMTP id 00721157ae682-2f863469afbso119177587b3.0 for ; Sun, 08 May 2022 03:48:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=39cunk77Bq0ryERvH4GA4MmnnrQzSnzKrRawE3qA/ZQ=; b=TTx6+It704bJtIbGhcT0Q4urRZZKi8In8MMnfaGKsAhGsqradcSNMk3yKTaTAp9OS2 gpsw0fY5T7bbLHWIkG8B/yxUaMIfXmkovSW53vc3dgIz2E3tLer4D8GZY9SnQEF5mXZ+ nhWutFXIW/zUTx18iOyMe/sLIv7ldjaOUGdmlU7DTEAXveyDvXZ5Zrd85Z6W9htSJNM5 Xb4EPkxYU7ssO+5h6J/ggURxyEOmgu/s+EiyiMUq+E3jR7/SvrLdxfAJNCp0XUjYUarL gsMVURpdnZ6pJVYC2WvLCfr7Hn3U9LcVs8GLvjBI2v95dqtViT04H5Ms4X+p4YP8ce9z VPkA== 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=39cunk77Bq0ryERvH4GA4MmnnrQzSnzKrRawE3qA/ZQ=; b=wyxjXPgwWjxRk/hg/AXveDI8b3NLzK+zyXRx0on9GttS2R6fQAIFa7UwQaHcURu6bf NdunlcqWOCzdQBFKjdV+ppHlpmQnw5/NhWGTlLrimbaYwUX9yS8tHZ+Sjf+wi4JmlxoF iv1039NPZzbotstx1hCxjjA654BmHIU/cFzBVBpmn2/53cSgOO5lauqAWR5qP/VGJP4U tCg8kNo0Nngq/dv2rkFKTFR88sQvvGoqiy5XQFOPdYBjUm/GSnX1mR+JuOjr4isYg6Sn /subdDOkBqzZIaaAuQYnrHvtgyqDPpyoYfWcK+OLUSmIqAAyc/tvfMAoNHtKKtBefRyW YSMw== X-Gm-Message-State: AOAM533/v8RaWuW4JsY1qlC1sd4IEOqEReh+oXcyM9zJP+Nxys5ulRyb 6v7C9qo6ytWX85hwGr2qlqzsR7YNIDYpgjKj0o9sYkNzigE= X-Google-Smtp-Source: ABdhPJwJIfz4FEXz+eu6ISo/pnXQ8xT/e/dmOVJZ3XhrCnc094e9ZZQXz5ei9/M8SGn5mJwDm3WSEB+E7QFss6+DFAk= X-Received: by 2002:a81:14a:0:b0:2f7:bb55:1bc3 with SMTP id 71-20020a81014a000000b002f7bb551bc3mr9700508ywb.484.1652006913527; Sun, 08 May 2022 03:48:33 -0700 (PDT) MIME-Version: 1.0 References: <5598bad8-4e1a-7638-d3aa-36b02568d1a8@alec.pl> In-Reply-To: <5598bad8-4e1a-7638-d3aa-36b02568d1a8@alec.pl> Date: Sun, 8 May 2022 03:48:21 -0700 Message-ID: To: Aleksander Machniak Cc: PHP internals Content-Type: multipart/alternative; boundary="0000000000003f549605de7dd5d4" Subject: Re: [PHP-DEV] NULL Coercion Consistency From: jordan.ledoux@gmail.com (Jordan LeDoux) --0000000000003f549605de7dd5d4 Content-Type: text/plain; charset="UTF-8" On Sat, May 7, 2022 at 11:53 PM Aleksander Machniak wrote: > > What happens if you pass FALSE to such an argument? int(0). The same > would happen with NULL. > > The thing that everyone seems to be glossing over with these coercion examples is that in order to have any scalar value, it must be explicitly set *somewhere*. That might be inside an internal function with a pass-by-ref, it might be on a regular old assignment line, it might be as the result of a function return... but somewhere the scalar must be set to that variable. This is not the case with null. If you use the unset() function on a variable for example, it will var_dump as null *and* it will pass an is_null() check *and* it will pass a $var === null *and* it will return false for an isset() check. Null loses these qualities if it is cast to *any* scalar. See: https://3v4l.org/lUcVV False being cast to int(0) at least doesn't change whether or not it will return true or false for isset(). Null fundamentally has the meaning that a variable is uninitialized, no matter what other ways a program happens to use it. Jordan --0000000000003f549605de7dd5d4--