Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:116998 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 62355 invoked from network); 7 Feb 2022 14:19:14 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 7 Feb 2022 14:19:14 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 637D0180511 for ; Mon, 7 Feb 2022 07:34:59 -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_40,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: No X-Envelope-From: Received: from mail-lf1-f50.google.com (mail-lf1-f50.google.com [209.85.167.50]) (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 07:34:58 -0800 (PST) Received: by mail-lf1-f50.google.com with SMTP id b9so27577283lfq.6 for ; Mon, 07 Feb 2022 07:34:58 -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=nqr3xLIviDo4GgDryRNoDrDREz0GgdEa8Ql5SelLqqc=; b=OyrQFRWatDZz86WEpVMdKMctTK6CHol73NRQe+yuWlEhEUedj/un1wqIAfFsO9cjfy KEq6jPXdUGR9/dBkCAxrS8W4IrrTIGhkVBrsXll/gzlNd2eZKcvyNF8ZvKGosyL2JLNs aq2He3wHREu5zcD4/Mn7Nyhk4+FSo5UBlD2ME= 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=nqr3xLIviDo4GgDryRNoDrDREz0GgdEa8Ql5SelLqqc=; b=2CLAEptj+jDaQkZ3kNUPDZptLyweeWQgx0d00K2GlMOaQvyk60pqqa6egqZ1l2mvO0 C+qypW8FVJHRokmXv03ZpIe+zqC5S5wrYNO6lDzyquWjpvxinM4TMW8vEDw0nA4tWbfi hORW+mAyA94Al3inPmqwzQh33QR9HgewYYhhsbDxr6FtZu/OxPkxwtSA6rpke7uuk9lx aBAqlPMMJ5S6myKdvbJgd4uJAM2t0Y0HsoEe7bjtYlyB8drMTQay/YO4YanpQd1yCw7s EptiY92eFrOjZ+6sByKbakTKt+XCO90MyF9epWFxdpIeYWjTfx7VUedP1BVx0CjnYEj2 HZsg== X-Gm-Message-State: AOAM530N3zZJMMP6RmhuJDn6KksIlV9wOLodeL7DGki8as4OSyUmdYRv 4ExOUNC5QrDzPkP0D+Bj904pHhgFGpa8lFNmkZh4Gw== X-Google-Smtp-Source: ABdhPJymV0V3zpUy35dof0ZojmE0qA3LTozbw6CtGzJvFVq1Dfiag32Ypv5dbFVjg392YXmfxDsz1Pgm+khS4CEcqsY= X-Received: by 2002:a05:6512:21b:: with SMTP id a27mr80958lfo.302.1644248095360; Mon, 07 Feb 2022 07:34:55 -0800 (PST) MIME-Version: 1.0 References: <6200d9f4.1c69fb81.1d3f2.8b60SMTPIN_ADDED_MISSING@mx.google.com> <620111c5.1c69fb81.c49f5.c38aSMTPIN_ADDED_MISSING@mx.google.com> In-Reply-To: <620111c5.1c69fb81.c49f5.c38aSMTPIN_ADDED_MISSING@mx.google.com> Date: Mon, 7 Feb 2022 15:34:44 +0000 Message-ID: To: Mark Randall Cc: internals@lists.php.net Content-Type: multipart/alternative; boundary="000000000000a5a46f05d76f57fc" Subject: Re: [PHP-DEV] Allowing NULL for some internal functions From: craig@craigfrancis.co.uk (Craig Francis) --000000000000a5a46f05d76f57fc Content-Type: text/plain; charset="UTF-8" On Mon, 7 Feb 2022 at 12:34, Mark Randall wrote: > With regards to your framework comment, any framework worth its salt > will also have the option to provide a default value other than null > when the value is not provided. > Frameworks do allow developers to provide their own default value when a GET/POST/COOKIE value has not been provided by the HTTP request. But the 4 frameworks I've noted have already chosen to return `NULL` by default... and while the distinction between an empty string and NULL is rarely used, it can be helpful. The only oddity I'm aware of is WordPress (who don't really care about types), and while `get_query_var()` doesn't exactly map to `$_REQUEST`, they did decide to use an empty string for their `$default`: https://developer.wordpress.org/reference/functions/get_query_var/ So are you suggesting that all the frameworks should change their default to an empty string? or every single project should update every use of these input functions to always override this default, or cast the received value to always be a string? all to avoid a Fatal Error if a NULL value ever dared to be passed to `htmlspecialchars()` and similar functions in PHP 9? Or would it be simpler to allow NULL for some function arguments? --000000000000a5a46f05d76f57fc--