Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:118862 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 13211 invoked from network); 20 Oct 2022 17:20:58 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 20 Oct 2022 17:20:58 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id AEF42180044 for ; Thu, 20 Oct 2022 10:20:57 -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=-0.2 required=5.0 tests=BAYES_20,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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-wr1-f51.google.com (mail-wr1-f51.google.com [209.85.221.51]) (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, 20 Oct 2022 10:20:57 -0700 (PDT) Received: by mail-wr1-f51.google.com with SMTP id v1so6568553wrt.11 for ; Thu, 20 Oct 2022 10:20:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=craigfrancis.co.uk; s=default; h=message-id:in-reply-to:to:references:date:subject:mime-version :content-transfer-encoding:from:from:to:cc:subject:date:message-id :reply-to; bh=tyiMdKOsWE66EnYZqiJ88sHZnhfl4ShFWucgw+ZRFyU=; b=B7RDpSXTUd7JOgQH8bN1dCRU4WkgaT3ImRmQgKz+4zyjwVr3G0lyUMhgAF+GAn0y9j a49fF48aAVgB4wti76+H45vXUA9RlNEJpRzBhmYkBqgkrr2pcRWtM784JxXel6SBlxw4 fjGfX0Gy1eB3TVjhpxNlgB1AIMR+Sdt1XHdGI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=message-id:in-reply-to:to:references:date:subject:mime-version :content-transfer-encoding:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=tyiMdKOsWE66EnYZqiJ88sHZnhfl4ShFWucgw+ZRFyU=; b=VJsQwi4F3fZ2IIr2QPsOT+T11wNtmKl7k7iGnYezecpE8iJ1NXujRwA+xtABWdGjPu 5LUBUFBMSCdhesh+dHNPD59miIIsC8tFwPa3KSOoHfoUOg59JxGp+PJ+DA7Wllm9ujqU 8H3S9AM17MnB4wj2098qnyL55zqc35/fCuxRhNXw9E5rzNZSeyWCI1hYNdZMD0wqBMz+ ZXvSdP04kgi4XJmiP+jsnP9BD2AMo+zmIi1oD5MkGJnXzWL7ucagUH7oODBqw6tkxFxx wzVFn050JukwAlt///jl3rPRHjaKar48EAFu0ZpZFyVUnqbn4QFnThixm3Iq8WkUzUSj 6nwA== X-Gm-Message-State: ACrzQf1QTPbRDEww7DLQq5lQUg+HEmFTa1aZHH3U4mjciEOEDhwcQlno 7qqVg/WLkeKlWFNlO9ZlzINh+8mxORLlhw== X-Google-Smtp-Source: AMsMyM6RwB0WwPg2LRZooK7rFaSJqly6q5943ZqMYX4xP2JPO9N9R3fQspiGi6JTS1JyhtcBmUsCQQ== X-Received: by 2002:adf:ec90:0:b0:22e:6ef1:1849 with SMTP id z16-20020adfec90000000b0022e6ef11849mr9742970wrn.695.1666286455856; Thu, 20 Oct 2022 10:20:55 -0700 (PDT) Received: from smtpclient.apple ([92.234.79.97]) by smtp.gmail.com with ESMTPSA id o32-20020a05600c512000b003c6edc05159sm532946wms.1.2022.10.20.10.20.53 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 20 Oct 2022 10:20:53 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.1\)) Date: Thu, 20 Oct 2022 18:20:49 +0100 References: <2B63A776-11B9-49BF-AE0A-FCF7F4E738F2@craigfrancis.co.uk> To: PHP internals In-Reply-To: <2B63A776-11B9-49BF-AE0A-FCF7F4E738F2@craigfrancis.co.uk> Message-ID: <5049707D-2376-4C3F-995F-783D6474569F@craigfrancis.co.uk> X-Mailer: Apple Mail (2.3696.120.41.1.1) Subject: Re: NULL Coercion Consistency From: craig@craigfrancis.co.uk (Craig Francis) On 28 May 2022, at 03:36, Craig Francis = wrote: > On 8 Apr 2022, at 18:34, Craig Francis = wrote: >> I've written a new draft RFC to address the NULL coercion problems: >> https://wiki.php.net/rfc/null_coercion_consistency >=20 >=20 > I give up. For everyone affected by this... Rector has a "solution" via = NullToStrictStringFuncCallArgRector. It has a list of 275 functions (442 parameters), and every time these = functions are used, and Rector isn't sure a variable cannot be NULL, it = will add a string type cast, e.g. - + So yeah, it's very messy, and while I think it makes the code worse, at = least it's one way to avoid the fatal errors (coming in 9.0). Oh, and developers can easily re-introduce more "problems" (because they = might not be aware which variables can be NULL), so Rector will need to = re-run. I'm also tempted to create a composer library to provide a second = solution, by using a namespace to re-define these functions, e.g. Have fun, Craig = https://github.com/rectorphp/rector-src/blob/main/rules/Php81/Rector/FuncC= all/NullToStrictStringFuncCallArgRector.php#L37