Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:127802 X-Original-To: internals@lists.php.net Delivered-To: internals@lists.php.net Received: from php-smtp4.php.net (php-smtp4.php.net [45.112.84.5]) by lists.php.net (Postfix) with ESMTPS id C47DA1ADE6B for ; Mon, 30 Jun 2025 14:56:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1751295305; bh=9mY11yy6qpZYBXVuqp49jY0dzK2NSwcg71D78k9SCQs=; h=From:Subject:Date:References:To:In-Reply-To:From; b=keWzRG+zriUuZOPYnJlH8pBB2UeJtUMqP6BdV991+fWmLSZVoskrSADNZX27Xbt1t EMaQqfHvWc+gDxrPHn5jHh8dqugTtco6e/OnsGPLA1k1iHxwZoCXqYS+QidDBoNezo QMVU6tjYZbMPAyBthLHK025EIYLCj3e8QFVzOsvLmD4qNdjOeyoL0CpPc/9At+J/F9 EGK68vNNgMLMAkdqcgq3JQcPOz/a8G0Er4oRBJgiPBs6KCX4QADhVQHe8v7gYa4kct hT/qvV2WUqxI4zxQIJYUXmjoExmXbFmT0C5aw/UuIJC7BVFFerARaYJA8D969flw2u EqVAWrrlRlVeA== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 54DF5180503 for ; Mon, 30 Jun 2025 14:55:02 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) 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,DMARC_PASS,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: Error (Cannot connect to unix socket '/var/run/clamav/clamd.ctl': connect: Connection refused) X-Envelope-From: Received: from mail.gna.ch (mail.gna.ch [212.45.196.109]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Mon, 30 Jun 2025 14:54:59 +0000 (UTC) Received: from smtpclient.apple (unknown [194.169.219.181]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by darkcity.gna.ch (Postfix) with ESMTPSA id A58613A0F41 for ; Mon, 30 Jun 2025 16:56:51 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=cschneid.com; s=default; t=1751295411; bh=9mY11yy6qpZYBXVuqp49jY0dzK2NSwcg71D78k9SCQs=; h=From:Subject:Date:References:To:In-Reply-To; b=KGzdTOdayphjB4DDwk3zlTdSmkcdC0BsfJJDpYLdFiiDmOslxjnZwMmCuRwOavsfl sXwvSqoM8/gz/X9dvoFs6TcSwFz5Y5oKT342w1qpUzIvtOpe0FFWMnOtOxgsPTpZgV nPuaNygyVUR7kZLkQ1VbbtkjY+/xH3T/+XpKdOI4= Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3826.600.51.1.1\)) Subject: Re: [PHP-DEV][RFC] Deprecate type juggling to and from bool type within the function type juggling context Date: Mon, 30 Jun 2025 16:56:51 +0200 References: <3Yl0UGauXmKqk7s7Hqbv6iaXru-hZHf8Wj6VjwwihgRSaqZo5EZ2ndsOle-ae41C-lvnirynWt6PpuD7UJPL0zPCw18QHFE81Eb--fiiEbc=@gpb.moe> To: PHP internals In-Reply-To: Message-ID: <57000669-EBAC-457D-BAB9-5B7CA2497BEA@cschneid.com> X-Mailer: Apple Mail (2.3826.600.51.1.1) From: cschneid@cschneid.com (Christian Schneider) Am 26.06.2025 um 14:04 schrieb Gina P. Banyard : > On Monday, 2 June 2025 at 17:11, Gina P. Banyard = wrote: >=20 >> Hello internals, >>=20 >> This is the first RFC out of a set of type system related RFCs I want = to propose for PHP 8.5. >> It also used the recently enabled Markdown support on the wiki, so = there might be a few oddities. >>=20 >> The RFC proposes to deprecate implicit type coercions to and from the = bool type for other scalar types. >> This a "weak" mode change only, as when strict_types are enabled none = of these coercions can happen. >>=20 >> Let me know what you think about it. >>=20 >> RFC: https://wiki.php.net/rfc/deprecate-function-bool-type-juggling >=20 > I have updated the RFC to version 0.2 that expands on it and addresses = some of the counterarguments which were said during the discussion. > RFC: https://wiki.php.net/rfc/deprecate-function-bool-type-juggling >=20 > If there is no-follow up feedback, I will open the vote for it = sometime next week. The RFC talks about "from" AND "to" bool conversion but the examples = under Backward Incompatible Changes only seem mention "from" bool, is = that correct? I tried the implementation in branch bool-juggling-dep-poc on = https://github.com/Girgias/php-src.git and encountered two things: - php -r 'strlen(false);' produced a core dump with Zend/zend_API.c:561: = zend_arg_from_bool_deprecated: Assertion `func->common.fn_flags & (1 << = 14)' failed. - array_slice($a, 1, preserve_keys:"a") did not produce a warning even = though I would have thought that is a "to" bool conversion. Am I wrong? = What should I test instead? So far the "from" conversion warnings need changes in very few places in = our setup (we very occasionally use false as out-of-band signalling and = use the side-effect that strlen() can check both for empty string and = false at the same time but that can be easily adapted), our lesson from = the nullable parameter that composer packages are the more interesting = caveat than our our own but so far nothing popped up. Summary: I am mostly positive about the "from" part, I don't think I was = able to test the "to" part and I'm not sure why I triggered an = assertion. Regards, - Chris