Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:117739 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 72091 invoked from network); 17 May 2022 08:41:56 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 17 May 2022 08:41:56 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id CA7C418004E for ; Tue, 17 May 2022 03:22:23 -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.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE, NICE_REPLY_A,RCVD_IN_DNSWL_LOW,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: AS8560 212.227.0.0/16 X-Spam-Virus: No X-Envelope-From: Received: from mout.gmx.net (mout.gmx.net [212.227.17.20]) (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, 17 May 2022 03:22:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1652782941; bh=zT8SbZmIpkArTymr6XHllTgLTeAbV4mUHOiGvU5RXNw=; h=X-UI-Sender-Class:Date:Subject:To:References:From:In-Reply-To; b=YbBWsBW8HEG8nU10SVxj2qpm8u5qBYEgaIpvVsLKMAXB51EkUIADUwdaWKFiEg3RY d6ncvzLKDVwVfh9eSVDHMV4pwezcPNbipxnI75zAqM04VsjiocYcXu+s7qJFOF2JZu ka8M88sqIlW9E6Y1mr/b/zBwffVnJ81FcVIkRILk= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from [192.168.178.120] ([24.134.51.41]) by mail.gmx.net (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MhlKy-1nMEM1286C-00dpzF for ; Tue, 17 May 2022 12:22:21 +0200 Content-Type: multipart/alternative; boundary="------------mQCEsU8x0GF2fUnavE58Xw23" Message-ID: Date: Tue, 17 May 2022 12:22:21 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.0 Content-Language: en-US To: internals@lists.php.net References: In-Reply-To: X-Provags-ID: V03:K1:YJYfwIfWsI52FfMMX9iB3ciSYHW8MYK7AKQ+cT6HZY5t0OBLd8U rcnfe/pw+kIOqg40B1tJw6lBkItVL1fWPUimmCKGtt0HACoTfzAxU9HgQ8slavG/7wfG57t wkcLj3LOFQX+y/0LFaWvThTgOY1jTsUVfBUD5dr/kwIEEzj8cCth3Pf7S20eS/GNpK8Py9X aD3Gdj7OqAFZVDEszn86A== X-UI-Out-Filterresults: notjunk:1;V03:K0:NeTxvLdLxoY=:Npt3FUkxnZ3yAaYYdRFK6L gsQv1/cXsafMUFgYxG3M+PqEnxoOEececRGmbrcmhU2p5J1Jm8NEuFUn4tmBhbiX4G5rnICaO CNbhHc5hvSxBXvUNRu0lk6ulAxC1T+6zcsXl0UfhrrBqFZbZXXtHFXkixoIEmn5i2O5p72ZlI Y1PN/ANw2dXkpjeTCR1LftxBVrpz1cP/tCRItqXqdHr5y8vA0O8uWVpOZPklvEKxE+NhTvvUi 8FxRhKw5pwUCMD+CbTPeA++JFoMofpLbu+lV2xryIqpvuM9n1WymKsmWAF3g85viZTrp1wJpa W9aCwUcQzylbsKiSikuhG4dhyw1/1wlgrxxdjOvRBlMOoKjkVe9TP+/NRLr0JU1EpJKDhsJGa rfpgcUP7mExwVwlhcixUXS2K14/nhIn1FEdQTnzeos0kw5MrjUkZvwweMRIEaBKjZUBdme/OF 3OQZ5GNPDkUoJYRKMaRW41AMsoJ9XpInwetXzKPQ1i89H4Hva4cc9YxoAv1GGrx2ir1Itecba iM4nLZ+KdJf8T+2GG7pnLv4SWeRbCu8GXMq8enWff0LixCRmQ9TVQltJOUYbF7hsBdnX/5lRs kmwvXdR8/brjua1HtHA7LjHwsOBEkW+C7RO68NscO+0mtQztENQf7dfNoeeyo4XMlpgtU4Wu6 Wm26/j2NuKoH1YVyzpCiYSQe13CRa7Xm3Kwe1QZ55CHRQvlSGf2vho3WEOOyv8N6yRatYEF9V 2vB1n5vYQl3PZWl9W1QscgQ2aS+W92+XKpy9ff2Wihw2SAjlTPES7gPpiFAQXCxnuxaSM15nR N/zMQckqZKQ19dlugktPriJQASMB4FiJKu8n7vF09TbY5gbe7KuzpXOcC19fPf9JESeRcPuMS PFoVY8vJIpndU1hiSp28hySfntcpqF1797kXWl0AVwpbKtoBRHgiWuVqy+Qql/m7TSO9DpTk9 fkP9CC6ySbJd3GJAhSfjQPdle7aOTftyU7E9Ird4ROjXefKe+R1GGsrd3xMwRJ0nMcoHLCqrO XufKxpQPj/yKHfs3lGCAz/YkNAG3P1Vf30INVBfvyl4imW2g3lJF/8g0+Kv2xtCgbUduZ3XYS l4ox/icdjQQRAY= Subject: Re: [PHP-DEV] [Discussion] Stricter implicit boolean coercions From: a.leathley@gmx.net (Andreas Leathley) --------------mQCEsU8x0GF2fUnavE58Xw23 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable On 17.05.22 11:18, Jordi Boggiano wrote: > > Thanks for the RFC. I think it's overall a good idea, especially for > cases like "false" =3D> true, and arguably for ints >1/<0, but my gut > feeling is the string=3D>bool deprecation will lead to a lot of pain. > > I definitely see this being done in many places where you expect any > string value to be true and an empty string to be false (without > consideration for the "false" case which is more common in config > style use cases). > > I don't know what you could do to improve this without making the RFC > useless though. I wish these things could be tried out in alpha or > even up to early RC builds so we could hopefully get community > feedback in before deciding whether it's worth the pain inflicted or not= . For what its worth, I already found some bugs in the php-src tests where a function definition was probably changed at some point and a string was passed to a bool argument which was obviously not intended, or where a weird value was used for a boolean argument without any apparent reason. These are the type of unintended coercions I am trying to bring to light with the RFC. Using any string as true is also already a bit dangerous: "0" is a special case string that results to false, which adds a big wrinkle to the assumption "non-empty string is true". My main arguments why I think this will not lead to too much unnecessary pain: * Each individual case is easy to fix, the easiest (but also least useful) would be to loosly compare a value to true ($value =3D=3D true= ) instead of directly giving the value to a typed bool * bool arguments for internal functions are usually optional, less numerous and are much more likely to be set by a constant expression than a variable * deprecation notices are easy to ignore, and the "disadvantage" of the high number of deprecation notices with 8.0 and 8.1 should be that most tooling and codebases have gotten more used to dealing with them without too much panic I also added these points to the RFC, because I think there is some resentment built up for deprecation notices by now, which I can understand= . --------------mQCEsU8x0GF2fUnavE58Xw23--