Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:116557 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 93221 invoked from network); 2 Dec 2021 14:20:47 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 2 Dec 2021 14:20:47 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 6DD15180211 for ; Thu, 2 Dec 2021 07:19:46 -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=2.7 required=5.0 tests=BAYES_05, HEADER_FROM_DIFFERENT_DOMAINS,HTML_MESSAGE,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_SOFTFAIL 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-f54.google.com (mail-lf1-f54.google.com [209.85.167.54]) (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, 2 Dec 2021 07:19:45 -0800 (PST) Received: by mail-lf1-f54.google.com with SMTP id b40so72310929lfv.10 for ; Thu, 02 Dec 2021 07:19:45 -0800 (PST) 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=zpZi2H30fV03437A/ufpLMRkyVJkYJ4+9n8nLNO8MIw=; b=WHWFZi4+aAwgVcB+JualuSnKRd2b/21GMhkL6V0TlyAE54DMZ3a49itNKXfg4CQFJJ SUeC5/0Uhb2EcM547a4yQijWuLOs4yq93YJA/MjFX+R1zpTxIJ7EFNI1/Dp/xGl6RpZX upuSt908GuW1Oi6Cw2/mxUZSeZ23rIrBH3Iwit3Qgsk/mz8+Ub2Xk9/hapPL5x3+fl9g d2YP+6CvuFPfl+EYdo8hEcVWOyj5irZVrdt4rnTRrTjiAul1nitiCoQDEwmXZlPr682J FJKppcnVVVIGyW/OGsAr1ZRrq+0VBUdIRtUu1FO9lUidKD7gbip4Yc5V0Hs/nFfYKV9f 8dqA== X-Gm-Message-State: AOAM531ZFa4IgvbJkuXaSVVoeR/l+m+7q4VheHbVpDjjp/WALCl1QLAo 1qPkfubyVHxcQMMH/PCQsDpfgheh4I9n20u5NQmKbfDJtdURWA== X-Google-Smtp-Source: ABdhPJxis0e+Jj2VVJajpwfG8MdBOnt+s6sRjVvnTVURDoXyxA8L0RMwoQFdJYslircaGRygd5j+EyhNAX3qdurQAKE= X-Received: by 2002:a05:6512:ea2:: with SMTP id bi34mr12932489lfb.12.1638458384228; Thu, 02 Dec 2021 07:19:44 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: Date: Thu, 2 Dec 2021 09:19:33 -0600 Message-ID: To: Craig Francis Cc: PHP internals Content-Type: multipart/alternative; boundary="000000000000f8bb7805d22b51d0" Subject: Re: [PHP-DEV] Allowing NULL for some internal functions From: pollita@php.net (Sara Golemon) --000000000000f8bb7805d22b51d0 Content-Type: text/plain; charset="UTF-8" On Thu, Dec 2, 2021 at 8:48 AM Craig Francis wrote: > On Fri, 26 Nov 2021 at 16:47, Sara Golemon wrote: > > > I'm not saying send PRs to fix them all... Let's make PHP better, > > together. > > > > On a similar theme, trying to avoid too much work for developers upgrading > to later versions of PHP. > > Is there any value in me proposing an RFC to update *some* internal > functions so they can accept NULL? > > I see developers using their framework of choice for GET/POST/COOKIE/etc > values (where they receive NULL to represent unset values), or simply doing > `$q = ($_GET['q'] ?? NULL)`, and other sources... where they will now get > deprecation messages whenever they use functions like `htmlspecialchars()`, > `trim()`, `strpos()`, `strtoupper()`, `strlen()`. > > I'm not hard against this idea. The interpretation of null in these contexts as being equivalent to empty string isn't unreasonable. I guess the only objection I could have would be an academic one and I can't really defend that. So yeah, sure... why not? I would say that such applications should consider unifying their own types. $a = $_GET['q'] ?? ''; Is there a place in the application where empty string and null would have been distinct? i.e. Is a search for nothing different from not searching? -Sara --000000000000f8bb7805d22b51d0--