Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:116989 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 30770 invoked from network); 7 Feb 2022 07:37:40 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 7 Feb 2022 07:37:40 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 2553B1804C9 for ; Mon, 7 Feb 2022 00:53:21 -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.2 required=5.0 tests=BAYES_20,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 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-il1-f176.google.com (mail-il1-f176.google.com [209.85.166.176]) (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 ; Mon, 7 Feb 2022 00:53:20 -0800 (PST) Received: by mail-il1-f176.google.com with SMTP id 15so10428649ilg.8 for ; Mon, 07 Feb 2022 00:53:20 -0800 (PST) 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=B9odCHOkbiekHUxAwclx+w26kcHY7Al3S0R56zhotpA=; b=kXVFBc+jFuJDzoEh6dhk/GODy+Xu4eT4M9demXvXm3Kwfh/6uMGgq7cjZ4+DKGlMin U9RbM2ytpE9M7yX0h63JdAFDKgzJCEpsFaJPZyQhMOIy1zTGTmjI7DVyxK9or7GyFCxv S+arOCL+I9mp1o8zYcITm1fpFxhMpb4DkKhSm2aIgc+Ui5K3ATfkdJxiifgB2gHPOZo3 XOi/GGkv0rDWwLObeSTpDriKsNSLeUuSi6aq/0pkTu1QmxILQMClmlNSzMpNjoB0pf/V ZjL+RAJT1H1tT8klmMaB9oOXaOBJ5p7U7iNlpVGe9VcdMbgVrxvaOs6qeBWyprVP5Tfn m5xg== 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=B9odCHOkbiekHUxAwclx+w26kcHY7Al3S0R56zhotpA=; b=qA5265kx1EWp3PiOhr4jOUhdaEiCcWaWLKPogrlWk41Ov6/RPEZ2oAwgSnEN4Ab+E3 26AVRJE5bol/K0wjrxAqwE3kVWjXOxVd6F10NLDAKEsDCWw7ak1G00hTYy8MrrQGcA/U KGfLJsiCBTxp/VoiqKyVEjef1aL1IZCTIJqx3qkAPUmxZx/ItBZ531RvpA3FR/JkNxAa He+GDg1AOrDYjUiS/635xOX9WdaCG0mFS9hN8RjtdaItKlY0EZYhUS+w95Mfmvr0UaUt FM7Z5k//VV1TmJ/HIe8eiI5a0xgyq6kflnIgNYbBtbiT6nm3sriM6VyZF7xEVAyDcRnB LMBg== X-Gm-Message-State: AOAM532Ogj1uJ2jtp0meCufQzubcCvkdnXz/rg6NlaOG8KR++HGLtDE6 EwTQMVOoLqJqGL9zuosCja2q/hb1TxjgLZfSKIE= X-Google-Smtp-Source: ABdhPJzKBIL5cKNogU9Ac30t7R/IS/Vc60wwMFWqnJO0E8p+0Qxn3hJWX7n2rQiyYJgIaNNo8MgIeIk5FyLou0RagvE= X-Received: by 2002:a92:ca4c:: with SMTP id q12mr5775722ilo.141.1644223999998; Mon, 07 Feb 2022 00:53:19 -0800 (PST) MIME-Version: 1.0 References: <6200d9ef.1c69fb81.38c1f.3f07SMTPIN_ADDED_MISSING@mx.google.com> In-Reply-To: <6200d9ef.1c69fb81.38c1f.3f07SMTPIN_ADDED_MISSING@mx.google.com> Date: Mon, 7 Feb 2022 09:52:54 +0100 Message-ID: To: Mark Randall Cc: PHP internals Content-Type: multipart/alternative; boundary="000000000000737f9c05d769bb0e" Subject: Re: [PHP-DEV] Allowing NULL for some internal functions From: kjarli@gmail.com (Lynn) --000000000000737f9c05d769bb0e Content-Type: text/plain; charset="UTF-8" On Mon, Feb 7, 2022 at 9:35 AM Mark Randall wrote: > On 07/02/2022 01:27, Craig Francis wrote: > > I know one person simply said this was a "terribl > idea", but I'm still > > waiting to hear any details on why. > > The changes you propose are not something that I am comfortable with > either. > > I understand your motivations in proposing them, but to my mind it goes > against the direction that PHP is developing, which I think is the right > one, where errors and likely errors result in stopping execution rather > than allowing it continue, potentially silently (dependent on error > handling settings). > > If a parameter expects a string, that is what it should be given, and > its the callers' responsibility to ensure that is the case. If they fail > to do so then it's an error just like any other. > > IMHO reverting to "If it's a null we'll just pretend its a string" is > contrary to how the language should be progressing. > > It sucks that it was ever allowed in the first place. > > PHP has a long history of making descisions to try to make things 'just > work', and if history teaches us anything, its that we inevitably come > to regret these descisions down the line. > I agree with this sentiment. I rather see solutions that solve null values being passed to these functions instead. The in-house legacy framework I use has a small array wrapper that through `ArrayAccess` ensures `null` is returned instead of a notice/warning being thrown when accessing a key that does not exist. During `offsetGet` it will return itself wrapped around the value if it's an array. I'm not saying that this is a good alternative for the problem, it's just one of the solutions that can be taken to tackle issues with `$_POST` and `$_GET` access for example. --000000000000737f9c05d769bb0e--