Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:117796 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 20497 invoked from network); 27 May 2022 05:01:25 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 27 May 2022 05:01:25 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 80D73180507 for ; Thu, 26 May 2022 23:44:21 -0700 (PDT) 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-yb1-f171.google.com (mail-yb1-f171.google.com [209.85.219.171]) (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, 26 May 2022 23:44:21 -0700 (PDT) Received: by mail-yb1-f171.google.com with SMTP id i11so6383724ybq.9 for ; Thu, 26 May 2022 23:44:21 -0700 (PDT) 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=KMkiR7u2s5heglh1cxcjqEmZ7/DvrmU/0+l9dvSrXss=; b=Xke7vVjQfdOQfoV3DVFLOXSS9cRnr83VJI+uSHXW9ntDXnJk4uO/J3+EDTP7Lgi+iG preyu7bNYq46ggRT97WnM29PuD36An+UbSQphZPV81AoryXISBNwt/D+4F5fxw4eRacv CberaHL2tokGNeEuGaPIOdWtNpXFzgK4x9WGLH97ReBRoGVmOPvX2+ftj8rpDa9cWNOZ KQpq0l64/Ud4hbXznheKmrb65R65OBixi31KQoKqpkKWHmUjqGHrzsJnTktVIOtdvh6O uo5LJV1Iosw+U4cSRJ2K4JPwRoVVru59JmWcSNlLqUQFdBNqc8PGN5rw19VNcmtNjMpL 7pTg== 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=KMkiR7u2s5heglh1cxcjqEmZ7/DvrmU/0+l9dvSrXss=; b=em+L0d55IjBhA6wMtYXa4E2lUoz6r24uNmMGgzt3iHFlw5I04A5i/LtJbikuxZPBuK lwKSOXZt4pGiEzhufgeFfwSn4spm9qnxTHQa+iOhU5bEh1taGpnq+ViU8yUXSdQW05Vw iET3Zapg6TrfuqHkIVCyMdOxy022I8GatlMGFdCTZmc8gr20woxYsYA+ldtuBsDLUZ2m 7WRjpN0XQ63f3LGkjaDsn4z+iF2H6BDFr5a6KZ5+A6QFf9fRBtMya6zZ52HDBald/sVT 0MC7Craa5MQWClNvBJgan6Vty8Y1UR1GgKtnJJGqVR+SeanYY3PaUBnwLl8FO0x2jHEg ujtw== X-Gm-Message-State: AOAM5301sqxjc39s4Cyo83qpzQDd9fPW38gCmMIHqLwQvLC6LPtU4nrt LAxAOotzgUnEP7lFV5ClARkiRUVkFA0bTV/QJNo= X-Google-Smtp-Source: ABdhPJxPx4zCT22Jzr9W+rd9g3yVt/K+nHSbsG/0HpkVn1H64w0OXpWC8CZKSzv6iZ8XdxSMNpjQAVLn4QtlL9GCU4A= X-Received: by 2002:a05:6902:1009:b0:64f:b4b1:e9e5 with SMTP id w9-20020a056902100900b0064fb4b1e9e5mr24981036ybt.68.1653633860673; Thu, 26 May 2022 23:44:20 -0700 (PDT) MIME-Version: 1.0 References: <1755E8B5-229B-47B2-BBAF-B5E014F5473D@craigfrancis.co.uk> <1180af01-080f-ee0a-3159-74bf7e0a8aea@gmail.com> <73F563E2-7C31-4B5E-A6B9-AE1BD05ADD1C@craigfrancis.co.uk> In-Reply-To: <73F563E2-7C31-4B5E-A6B9-AE1BD05ADD1C@craigfrancis.co.uk> Date: Thu, 26 May 2022 23:44:05 -0700 Message-ID: To: Craig Francis Cc: Rowan Tommins , PHP internals Content-Type: multipart/alternative; boundary="000000000000daa5a005dff8a222" Subject: Re: [PHP-DEV] NULL Coercion Consistency From: jordan.ledoux@gmail.com (Jordan LeDoux) --000000000000daa5a005dff8a222 Content-Type: text/plain; charset="UTF-8" On Thu, May 26, 2022 at 5:21 AM Craig Francis wrote: > > It sounds like you got lucky - you have a function that has a problem with > NULL (but I assume it's fine with an empty string?), and during your > testing you happened to pass NULL to this function. As noted before, static > analysis is *considerably* better at these types of checks, because it's > able check if variables *can* contain NULL. They can also perform other > checks as well (important when your code seems to care about NULL vs an > empty string). > > Nearly *all* code has a problem with null. It very much feels like the original effort to deprecate null calls decided to resolve this by saying "let's have the language help developers improve their code so it doesn't have these problems in the first place", and this effort is trying to resolve this by saying "let's have the language support the buggy code in ways that makes it work". At my job, my task for the last three weeks has literally been upgrading our internal codebase for 8.1, and the biggest set of logs I'm dealing with is exactly what you're talking about here: null's passed to internal functions. Every single case I've looked at so far has been traced to code that was written incorrectly, where some code somewhere was not properly guarding its values, and error cases were slipping through. Jordan --000000000000daa5a005dff8a222--