Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:127821 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 9C0C01A00BC for ; Tue, 1 Jul 2025 12:40:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1751373543; bh=zBx9IHL/vBlDHQkaIDK9moW33+0+rG+lQofUd8Npygg=; h=Date:To:From:Cc:Subject:In-Reply-To:References:From; b=g7fOEumYU3faJG6Ps0IkPSB/DrjMJIrY4l/x0LFITS/ALlYlw1Re5WVjSUYewNqx+ gsbZPXa5T8ymBczcB65BPHg1vOuUu+T+qaOh/gactkgyW4e4GWYY81HAvhDPill+K2 h94GXs2SGNgWHkj5e/hH2uFm2rQf5n54YTfUVucmT5K/Wo+OWUUQunHqVCAuHNLc2R 2kyAVu+mfp9YNTXoIRmej05tq2uNLz/A1AbOmiSfEwrJygmeZM3LjehJ/l6/uMeowz dKnTrHWMcQFLgiSgXtL8nfWLmsxRc3vi//c4Ip/HnzYYWDogYS0o4qWzAvfd4rhLaQ WYA30oayf1q3Q== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 2A08818004E for ; Tue, 1 Jul 2025 12:39:01 +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=-3.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,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-24421.protonmail.ch (mail-24421.protonmail.ch [109.224.244.21]) (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 ; Tue, 1 Jul 2025 12:39:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gpb.moe; s=protonmail3; t=1751373651; x=1751632851; bh=zBx9IHL/vBlDHQkaIDK9moW33+0+rG+lQofUd8Npygg=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=4skS5bj3TYtawU/bDSVNimzyMOsLS9GzflC6FNsyhEdmEpSyppYKVNsbktLgE3osq oUj+1eir3zrylRrcoTAQYGIWURUYNLaaxg2jUaUgfwk/+KfR1S0FZTTCDwco2n/HfO K3Z/T3zaH+/WoXP7qYAbQm+lh8w5N+i2xI+Z3aGlRTy4NIYw4gzrinJphZ7/RKFB41 ELBwW8wN7pku5MaOYlUTd3iRGBDuVwyhFZlZ4TUNpwKVO4srzTj+T0QQPZ7P1siebx I/dlG4GsBXBtnPMLQ2vnhHke8z2ReW3RU+oGKRMK4YEGihV+247bIVqnP1sU8z302R USppBqsaIQNuQ== Date: Tue, 01 Jul 2025 12:40:49 +0000 To: Christian Schneider Cc: PHP internals Subject: Re: [PHP-DEV][RFC] Deprecate type juggling to and from bool type within the function type juggling context Message-ID: <_PD6Pm_be1h0d70p046HnYr9o1bvN-7Z1p7StpDPbA_r4PupUJF9U9jmsG44ZKoeQFB-x0qtZxVm4XlngoBJhBOl9BTo11Qf1hJ5g6Psho8=@gpb.moe> In-Reply-To: <57000669-EBAC-457D-BAB9-5B7CA2497BEA@cschneid.com> References: <3Yl0UGauXmKqk7s7Hqbv6iaXru-hZHf8Wj6VjwwihgRSaqZo5EZ2ndsOle-ae41C-lvnirynWt6PpuD7UJPL0zPCw18QHFE81Eb--fiiEbc=@gpb.moe> <57000669-EBAC-457D-BAB9-5B7CA2497BEA@cschneid.com> Feedback-ID: 96993444:user:proton X-Pm-Message-ID: 151d9e81732c1053610f76aea4abd39170c72491 Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: internals@gpb.moe ("Gina P. Banyard") On Monday, 30 June 2025 at 16:05, Christian Schneider wrote: > Am 26.06.2025 um 14:04 schrieb Gina P. Banyard internals@gpb.moe: >=20 > > On Monday, 2 June 2025 at 17:11, Gina P. Banyard internals@gpb.moe wrot= e: > >=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 th= ere 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. >=20 >=20 > The RFC talks about "from" AND "to" bool conversion but the examples unde= r Backward Incompatible Changes only seem mention "from" bool, is that corr= ect? I didn't think adding examples for "to" bool was useful, but I can add some= . >=20 > I tried the implementation in branch bool-juggling-dep-poc on https://git= hub.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. I forgot to update the optimized strlen opcode, I pushed a fix for this, pl= ease pull in the latest version of the branch that has been force pushed. >=20 > - array_slice($a, 1, preserve_keys:"a") did not produce a warning even th= ough I would have thought that is a "to" bool conversion. Am I wrong? What = should I test instead? I haven't had time to look at why this is not triggering as it should. But = some internal functions do weird stuff sometimes. > 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 nullabl= e parameter that composer packages are the more interesting caveat than our= our own but so far nothing popped up. >=20 > 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. >=20 > Regards, > - Chris Best regards, Gina P. Banyard