Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:117184 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 532 invoked from network); 1 Mar 2022 16:49:51 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 1 Mar 2022 16:49:51 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id BD9A618053D for ; Tue, 1 Mar 2022 10:11:07 -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=-0.7 required=5.0 tests=BAYES_05,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,HTML_MESSAGE,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: Error (Cannot connect to unix socket '/var/run/clamav/clamd.ctl': connect: Connection refused) X-Envelope-From: Received: from mail-lj1-f174.google.com (mail-lj1-f174.google.com [209.85.208.174]) (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 ; Tue, 1 Mar 2022 10:11:07 -0800 (PST) Received: by mail-lj1-f174.google.com with SMTP id t14so22925594ljh.8 for ; Tue, 01 Mar 2022 10:11:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=craigfrancis.co.uk; s=default; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=g4HV/Tz0yK4N1qwwIcHP9MRG+JgixZEmwq1fZfyNREw=; b=TnKBEH3gscFNstGswCxSw7BzERoVXrGOH9tOtdptXhC4bTBCZOKZ9eGTgnkrrQ0s5c YR6wG+fRihLo4giYHn2KNaUUToZqqTxNRoX0JE23M/Dy/lAmeO5nT2EnIqd6h/DWPzYk MqSIKQutRlE8U59ejIFZQ8gbjblSbyEWIeTDE= 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=g4HV/Tz0yK4N1qwwIcHP9MRG+JgixZEmwq1fZfyNREw=; b=cobAKS4RHQ9GPsmJ6lkmi9Au7dl713qI/2PGzBbAds0D/ThTws7Aw2q+O2y4tHEavE vyRfLwF8b6x7ZBsb5KiYDrhFQA2Htz40EUtynlBzwLv2gHrSPNTNA2t5GPfJPjRMhABa SHPBJb1NCH9JRHfmlxcHHC811cdmQcP6LKEN9ha2NKsmqj5KFhpaKXYBy5/sa6F/xQvV g63YyN+pkx14RtKVZ7JhIH5o7/khN1NA3RDOCzigYFEkuav5cNQVGA6pN9cs9CIM3QID h5jGYjbWj/wo3biHj4a3NieBx++P5TPcoe0L3cXCXsM0OlZnoRM0wuLGBAq3i/9Fqxtr s+tg== X-Gm-Message-State: AOAM530DwuNImaAwRoai0PrKcD5z2a8k6loy5Om53ZY0BExV7qjZi+mG Feocmee8OHHpjN8c09E1PcpwupVxGMa0xnkuYXcCww== X-Google-Smtp-Source: ABdhPJyLAUvBSUmGWmF8zfbKm21QPzY5C7MZDF7RN6vnujEy4ABNZCjcs83WskVKmS+OGyU1iCzaZPv6L2G5c61N+TQ= X-Received: by 2002:a05:651c:21a:b0:243:2154:a79a with SMTP id y26-20020a05651c021a00b002432154a79amr18289521ljn.212.1646158265660; Tue, 01 Mar 2022 10:11:05 -0800 (PST) MIME-Version: 1.0 References: <983552d8-11f1-b5bc-fb82-148347982fda@gmx.de> <5494eaa7-2fa6-8364-9683-a2c8c9789d81@gmail.com> <69642616-72b7-44fe-97a7-27ae03bc8fce@www.fastmail.com> <7fbed755-42e2-d023-285f-39863a97f297@gmx.de> <3665C848-B4C3-4528-AEFA-02C868748AA8@cschneid.com> <0b5bc29d-3814-0e1d-b94a-47790019c778@gmx.de> In-Reply-To: <0b5bc29d-3814-0e1d-b94a-47790019c778@gmx.de> Date: Tue, 1 Mar 2022 18:10:54 +0000 Message-ID: To: "Christoph M. Becker" Cc: Christian Schneider , php internals Content-Type: multipart/alternative; boundary="000000000000ab524205d92c168c" Subject: Re: [PHP-DEV] Allowing NULL for some internal functions From: craig@craigfrancis.co.uk (Craig Francis) --000000000000ab524205d92c168c Content-Type: text/plain; charset="UTF-8" On Tue, 1 Mar 2022 at 10:43, Christoph M. Becker wrote: > I said, the BC break doesn't appear to be *that* serious. > It is when it's a Fatal Error, and there are lots of them :-) > To elaborate: in my opinion, it is a good thing if internal functions > and userland functions behave the same regarding parameter types. Yes, agreed. However, picking *some* functions and make *some* of their parameters > nullable does not look reasonable to me. Also agreed... while I did start with that suggestion, I'm uncomfortable with making some parameters nullable due to how it would affect those using `strict_types` (where it can be a good check for some oddities). Since it has been brought up multiple times that it is hard to find all > occurrences which would have to be adapted, I suggested a somewhat > viable solution for userland code (namely to define userland functions > which establish the old behavior; and of course, you'd need some tooling > to replace the original function calls). But that's a lot of work, and creates even messier code... I'm pretty confident the best solution is to keep all parameter types the same (I could argue that some parameters could do with a "cannot be empty" exception, to reject NULL and an Empty String, but that would be a different RFC)... and anyone using `strict_types` will still have a Type Error when they pass a value of the wrong type to these parameters... the *only* change is for those not using `strict_types`, for NULL to still be coerced to a string/int/float/bool, as it always has been for internal functions... and I think this can be done to user functions as well, as developers not using strict_types won't have cared about this before. Craig --000000000000ab524205d92c168c--