Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:121627 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 69997 invoked from network); 9 Nov 2023 20:01:23 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 9 Nov 2023 20:01:23 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 81366180506 for ; Thu, 9 Nov 2023 12:01: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=-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-wm1-f42.google.com (mail-wm1-f42.google.com [209.85.128.42]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Thu, 9 Nov 2023 12:01:21 -0800 (PST) Received: by mail-wm1-f42.google.com with SMTP id 5b1f17b1804b1-4083740f92dso9187455e9.3 for ; Thu, 09 Nov 2023 12:01:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1699560079; x=1700164879; darn=lists.php.net; h=in-reply-to:from:content-language:references:to:subject:user-agent :mime-version:date:message-id:from:to:cc:subject:date:message-id :reply-to; bh=OrRSjKjmi2IWd3aZyiwO7AQPCJwlH5fVr6u2wmLVD10=; b=mUA3B9DEgtu1SCzCDzBPxgbDm3sv5vyXBfG9WakNtr4CIPC4HPj7gPLDsgoX71VBJu OZIf8LHB7yaM7NMT54Qc6nWg5PT7dHBCMBiqZLG2sX8CJNk7HGGo3xrCbj6DpEqgK0dv 1eIQSfWfO9hCra95ypZPTIhqsI8dkD6A866K7+wK47pSQn/NizP+In29PVwYe0097a+d a2umfthZRPFlaTbX7ixgUhjUFzQmWCb/aBgmt+hFWjAbdiO+wRBb7bE6DticAt2z+pBH Z9CzOB8bYwXZfsY6vEiCzUyEA6Y1nq96NoPpO010QNI7+D9AlffkFd7V4aTbtAARJD2s H19Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699560079; x=1700164879; h=in-reply-to:from:content-language:references:to:subject:user-agent :mime-version:date:message-id:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=OrRSjKjmi2IWd3aZyiwO7AQPCJwlH5fVr6u2wmLVD10=; b=KUnYi+kStyJbexQmuoHPdp2zzRx6+avfp23/qYwwALs1rFGwJFHIvdLfI78N87k8v3 Fi+yVI1x/4Q1C8aTLVv4MF0g/cr+lJ2MBjv6U1JnpQni23xheXZtUdEigQkVCC0QE0Zk gGfQGowBea1pscsQ6y7u0eIKtLODkMCTsIofR8GSskwTI3frjzKCaa8VBd89ea23KC4J lR3MtYgjGb28JvXE67gXTcYvKvB3x8+OZcHVFCWRGfjpFh2XtJLOIlI8Q5aXKSgfY5T3 ftH7aHBTL6s+0V/KnbnAFWHkZD1TdRlNuS6TG9kFqVv4ewApnDUkXrvsbMSGDy929cYc j6Zg== X-Gm-Message-State: AOJu0YyP1Rea1uyYTODyw4HGZP9LWl5OlrEYLyMJP64z6ckz5RCxj9hb 9eqiHZnSdqRWZUP6pdUH0tc3BpNB+B4= X-Google-Smtp-Source: AGHT+IE9qaGBDpcu98RCG3m7H4ONrU+kxclzs2K6sVvs7ZyIeG9WZveF8I5099a0tCMoe5pFhwCujQ== X-Received: by 2002:a05:600c:4f8f:b0:409:7aa9:e0b with SMTP id n15-20020a05600c4f8f00b004097aa90e0bmr5223052wmq.32.1699560079404; Thu, 09 Nov 2023 12:01:19 -0800 (PST) Received: from [192.168.0.22] (cpc83311-brig21-2-0-cust191.3-3.cable.virginm.net. [86.20.40.192]) by smtp.googlemail.com with ESMTPSA id u8-20020a05600c138800b004075d5664basm3141814wmf.8.2023.11.09.12.01.18 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 09 Nov 2023 12:01:18 -0800 (PST) Content-Type: multipart/alternative; boundary="------------WIoFF1PFogC12leLileka49T" Message-ID: <049d4758-def2-4a29-9e02-afa61e5b977e@gmail.com> Date: Thu, 9 Nov 2023 20:01:16 +0000 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird To: internals@lists.php.net References: <5144806E-E21F-4AF8-B9A2-0161561A6B9E@craigfrancis.co.uk> Content-Language: en-GB In-Reply-To: <5144806E-E21F-4AF8-B9A2-0161561A6B9E@craigfrancis.co.uk> Subject: Re: [PHP-DEV] Re: Passing null to parameter From: rowan.collins@gmail.com (Rowan Tommins) --------------WIoFF1PFogC12leLileka49T Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 09/11/2023 14:58, Craig Francis wrote: > We might as well make the PHP 9 upgrade as hard as possible, just to force a little bit of `strict_types=1` on everyone. Just to be clear, strict_types has nothing to do with this; changing it does not allow you to pass nulls to typed parameters, and never did: https://3v4l.org/atT0B Nor has strict_types=0 ever been aligned to the loosest coercion rules used in other contexts; for instance, an empty string was never an acceptable input for an integer parameter, even in versions where it was an acceptable operand for addition: https://3v4l.org/khD32 As for your previous example: > redirect('/thank-you/?ref=' . urlencode($ref)); If $ref isn't set, any of these might be the correct URL: "/thank-you/", "/thank-you/?ref=", "/thank-you/?ref=default", ... The language can only guess one of those. A similar example I've come across is in manually escaped SQL (yes, I know, use parameters instead...): $sql = "Insert Into blah ( whatever ) Values ( '" . sql_escape($someVar) . "' )"; Nine times out of ten, if the PHP variable is null, you want an SQL null, not ''; but if the [imaginary] sql_escape function doesn't reject nulls, you may not notice the bug until you've ended up with garbage in your DB. Regards, -- Rowan Tommins [IMSoP] --------------WIoFF1PFogC12leLileka49T--