Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:121639 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 24015 invoked from network); 10 Nov 2023 12:16:17 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 10 Nov 2023 12:16:17 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id E113E180211 for ; Fri, 10 Nov 2023 04:16:16 -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.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE, RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS8560 212.227.0.0/16 X-Spam-Virus: No X-Envelope-From: Received: from mout.gmx.net (mout.gmx.net [212.227.15.19]) (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 ; Fri, 10 Nov 2023 04:16:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=s31663417; t=1699618571; x=1700223371; i=a.leathley@gmx.net; bh=9mq20vUHw92z7VD+0Y5hT76Lq1molvqU0WS70HntX9s=; h=X-UI-Sender-Class:Date:Subject:To:References:From:In-Reply-To; b=GCQ1+8FhRsv95InOEtQ9pvx7lhYCAaCQC4ceBiYQ8+FZvUWHEFVBXTfgB09x5bAJ joVUUzDl1/fHa7tjxsVRVrYr9K1BaTdBhuGNTbQYtb2oHA0gWWDq969cU6DIxcdjt 1bK/RdOHSgP2n8vjoYkuJ/Qqty9TYa7AXr2RWzafNthPusgU+MXjZUcfVW2GhSHEM vKTUJf7lMTBGW2+9l9AXn24ReUOBzyRat7lrT+9sJJNTuHplMxko4VsrFvN//xnt8 ac5xICQN17FmB9Tw2LjZdstuu54NahkZfzjbUGg9eIDGSoi7h2nmYsk6CVc/NpwWW RRTLP5QGBYQigEdYOA== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from [192.168.178.120] ([24.134.51.41]) by mail.gmx.net (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1M8hV5-1r658M2xc1-004kum for ; Fri, 10 Nov 2023 13:16:11 +0100 Content-Type: multipart/alternative; boundary="------------WdVST9ti61mZeaQVvt0uXguM" Message-ID: Date: Fri, 10 Nov 2023 13:16:11 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US To: internals@lists.php.net References: <5144806E-E21F-4AF8-B9A2-0161561A6B9E@craigfrancis.co.uk> <1A044D32-019A-4152-A3C0-3F393974AC3B@craigfrancis.co.uk> <88815C70-1100-442A-AFCC-A420862669C3@craigfrancis.co.uk> In-Reply-To: <88815C70-1100-442A-AFCC-A420862669C3@craigfrancis.co.uk> X-Provags-ID: V03:K1:/5pHo6R5KOLEtU3TyrBZutJWSXzsfrr5dKEMClYcWhrBOyRUJWW LHFr1Zm6mEyjeCqC4Jhqr3QFToGTi0/mV6OTLR/QX6IcuFtGoVCC02jLY73kD7LIi5JUNGY og349fKUgzt5oHMqH9COWBqQ41fhAUjVoHCIxKdAe2bWtkJ+XYBJrr+69BvvtUW0r2WHhLI osYN5Q3IA3GqbJYESxg6g== UI-OutboundReport: notjunk:1;M01:P0:1VoVWF/A9DI=;/XnPqd4sBHvxjiRsDENVggZpP03 hOgXdoQ3oSVpM34D4gHnG9/9Aibi6tTki7jW2m7GTHklzY45U2bYC1HgI8NMkGQ0wpRSA5dq+ ps3cjzU9F+Wbsx4ewGTPw5aPKlHIHv/eG1IEha9Lb7NZ+1OlCLDZBNwO3+mRaySD7+KEo1dDl XVFtTg9x/YgQu+cb5M3oD+h8nDL8CvDlD4hwZts6DTdfmYpanJvetfhpUgNPl8wM86f7rDrR+ XMkRmdJ73bqG87Rmgs8TQRgSpgRjg/El7juuWej5rWq8awUL0PJ3IlCtzf/5wygJA9TvwmnN7 1zbYOBRjtt7f3ZXyZAaUmX9NAcQnnmVwE8KMh343YOJawNVa9COuZZDPfdpMBGFykOy0iML32 7pOo9bgX0Kv2N2++ahekWhEwRikYT2GSzEGz39ZOH8hhojb29vLPPtYU9RecHJo9HMH+dtpUI TsGyh5reu33TBxNiet4JmY7qYIj0+C//NWlYWtivWl6HvhITwW7GpITJxh3jypYwwK/Lsu3Qx iutVI3/fgnrqkuESqfa2rwjzJRxqCzdMALu7jG0PhJkl+TxJVTFGLRtKwolcmM4+zDtUL/LR8 M6vOuLE/0jEt2tkP0TXIqrPrj/6SApdZoNFuXM94gZ5+q1n/R0l9ITDwt6t8ZMpmztAcThJGW /5YAPy6JJ33UgNDKLvnR1ZL7V2xQFXCNOE4MiPT+2o31DJ7zrSJkYwT4HSueuGoXxLam7ZMRp SmbT416o/Bd8npgl5aFbHJEqqDeEafwNJ2xHPJL5NrD4bNHOjsEBJU5A4UK0ZSNrAVHmaPy6i JujdFw9mPYSq6Wg+ngCJTh/p7mvwaLTdBQ5LTNAmOABj14tacWHaS4wGHad3bgYzg9oh/CdCz wTm7ySzbHuFYetbaXKM/veJPf9SczY7YLcgCQMTkp09ojotRmvdvFKvmLwRkOqU6o5ZWQ5BAu 7aIdVQ== Subject: Re: [PHP-DEV] Passing null to parameter From: a.leathley@gmx.net (Andreas Leathley) --------------WdVST9ti61mZeaQVvt0uXguM Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable On 10.11.23 12:33, Craig Francis wrote: > On 10 Nov 2023, at 10:54, Alex Wells wrote: >> PHPStan does find them:https://phpstan.org/r/38fc1545-2567-49b9-9937-f2= 75dcfff6f5 > > It does not: > > https://phpstan.org/r/c533ff42-80e4-4309-9751-1ec79e359946 Psalm does give you a PossiblyInvalidArgument here, PHPStan will likely detect this soon too, as both static analyzers are covering more and more ground. Also note that in your example $q could be an array (leading to a fatal error in the code)from the request data, which is why checking types thoroughly (not just coercing them with strval) can be helpful in avoiding unexpected situations and deciding how to handle such situations, instead of yolo-ing it. --------------WdVST9ti61mZeaQVvt0uXguM--