Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:127543 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 6DCCC1A00BC for ; Mon, 2 Jun 2025 21:02:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1748898024; bh=VT3LirXNb49bGGf6KhMOIDajsMER9pR1ozRg44Ddr18=; h=Date:From:To:In-Reply-To:References:Subject:From; b=Bn/OGTDXaM8/XHmY+OH3fljG5Rx6Z3jeIQamp3BlwJ7Haaqoqc6OAWwWvftLWURPI RrDx8yygGFWneQef+JcKDXpL3zSTIfhZrQpU7yfUiXZluQRQs9OibeUSYNntceuPp6 mn+Uj0ifYpaM1PSJTYMX0ZTFZlf8L+ZOxq1JpvE/4JF86NbMleXlIxd/ysGeJi7fom DnYmInscLtgMd9zLans7Mwd6IUlw1klf3uj2S69W9lzJx6/aS2IY0Sx2D56/W0caza ph1VmoX88k8ZeYg+ZlwKAGEXNi98pL7cR7iC7XNpacsxLj8yxt88QVkh7NZwXvcUuw 51o/IfeX6O9BA== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id CB0001801C7 for ; Mon, 2 Jun 2025 21:00:23 +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.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_MISSING,HTML_MESSAGE, RCVD_IN_DNSWL_LOW,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 fhigh-b7-smtp.messagingengine.com (fhigh-b7-smtp.messagingengine.com [202.12.124.158]) (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, 2 Jun 2025 21:00:23 +0000 (UTC) Received: from phl-compute-05.internal (phl-compute-05.phl.internal [10.202.2.45]) by mailfhigh.stl.internal (Postfix) with ESMTP id 7E86325400ED for ; Mon, 2 Jun 2025 17:02:27 -0400 (EDT) Received: from phl-imap-05 ([10.202.2.95]) by phl-compute-05.internal (MEProxy); Mon, 02 Jun 2025 17:02:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bottled.codes; h=cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm2; t=1748898147; x=1748984547; bh=VT3LirXNb4 9bGGf6KhMOIDajsMER9pR1ozRg44Ddr18=; b=pjrJt5UzB+2vcdWlsd98gtDJ0a ro2wVRDbh2ACybMi6rP+XmBpae6fMljfp/4BgI/yEmTAVSRwYn4v3+rSL8kNmUkf zraOtfD+aIPotjfsKkvah5K+16EDU8s1CxdJisoMkCWQMl2HtXc13PqqEragYv8+ tJMiozmUHFtd8frYbBjfJEulkaPPv92Qo5xLURq+21pLa7/tVTxqL+X5/QpqfumC YKF57LdK739Ls84WsDcdisx4+FJMYbxhH5P8Gkn9FdndPJSCH5WwchgYcTPjXpyw ZD0bMvPMapxkbMMHVPVqtQfkb2Gmm1Gi5Ad7V+7I9pAyFEp+juGmvmallVzw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t= 1748898147; x=1748984547; bh=VT3LirXNb49bGGf6KhMOIDajsMER9pR1ozR g44Ddr18=; b=P+g8ucY68Li1/kMH6mfMv98VSXS2JD1k1kyPzUDgRRXrVX+6vmd ly1wdXZQR7oBwDmWwV23vPQJu8KdzNukMktUU3WfvqG4LjgDQTMRIFNSst1b8ALO GRVjaLv/Une0F+q9ej/XpjPy54LBFS4Q+6UJAcN6VnNRTXoG1nCmYtM7K0ddiSI0 WYCBTsaQ6196u7Bc9zQCfWjHNLwNREJUi0J2uLmbIiRqCuoWZfOR4L0kOgpd9Nnu EPp4RJykNsJX+6xt9xOfN3j0AB1+tLFpyPIWlkx91zQlTpJDhv9WWLqWzAE/EatB pXwyG56oQ1IR5bbJEQNL0Ignq7WbsNvFLOg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtddtgdefkeejtdculddtuddrgeefvddrtd dtmdcutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggft fghnshhusghstghrihgsvgdpuffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftd dtnecunecujfgurhepofggfffhvffkjghfufgtsegrtderreertdejnecuhfhrohhmpedf tfhosgcunfgrnhguvghrshdfuceorhhosgessghothhtlhgvugdrtghouggvsheqnecugg ftrfgrthhtvghrnhepleekhedtgfefhfelieelgfegiefhkedvleefjedtffelhfehheff gfduteduuddtnecuffhomhgrihhnpehphhhprdhnvghtnecuvehluhhsthgvrhfuihiivg eptdenucfrrghrrghmpehmrghilhhfrhhomheprhhosgessghothhtlhgvugdrtghouggv shdpnhgspghrtghpthhtohepuddpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepih hnthgvrhhnrghlsheslhhishhtshdrphhhphdrnhgvth X-ME-Proxy: Feedback-ID: ifab94697:Fastmail Received: by mailuser.phl.internal (Postfix, from userid 501) id C89641820064; Mon, 2 Jun 2025 17:02:26 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 X-ThreadId: T93bbdd38331b9ecb Date: Mon, 02 Jun 2025 23:02:06 +0200 To: internals@lists.php.net Message-ID: In-Reply-To: <3Yl0UGauXmKqk7s7Hqbv6iaXru-hZHf8Wj6VjwwihgRSaqZo5EZ2ndsOle-ae41C-lvnirynWt6PpuD7UJPL0zPCw18QHFE81Eb--fiiEbc=@gpb.moe> References: <3Yl0UGauXmKqk7s7Hqbv6iaXru-hZHf8Wj6VjwwihgRSaqZo5EZ2ndsOle-ae41C-lvnirynWt6PpuD7UJPL0zPCw18QHFE81Eb--fiiEbc=@gpb.moe> Subject: Re: [PHP-DEV][RFC] Deprecate type juggling to and from bool type within the function type juggling context Content-Type: multipart/alternative; boundary=3738bb6916ca413995d107f501be6a56 From: rob@bottled.codes ("Rob Landers") --3738bb6916ca413995d107f501be6a56 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On Mon, Jun 2, 2025, at 18:11, Gina P. Banyard wrote: > 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 the= re 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 > Best regards, >=20 > Gina P. Banyard >=20 No offense, but this feels like it was written by someone who doesn=E2=80= =99t use non-strict mode very often. The rules around coercion are prett= y simple and well documented. Further, this makes a ton of shorthand nea= rly impossible =E2=80=94 the manual casting to bool in strict mode is on= e of the most annoying casts someone has to do (and people screw up orde= r of operations all the time leading to subtle bugs worse than coercion)= . Bringing this into all of php is probably not a good idea.=20 > Type juggling of strings to bool is similarly error-prone. The strings= "" and "0" are converted to false, but "false", " ", and other strings = which an (int) cast converts to 0 are coerced to true. If I understand correctly, you are saying it is weird why the bytes 66 6= 1 6C 73 65 are =E2=80=9Ctrue=E2=80=9D and 30 is a special case, but not = 20? If I remember my history correctly, 30 is special-cased because form= s used to send =E2=80=9C0=E2=80=9D on checkboxes (if it sent it at all; = it changed from decade to decade). I don=E2=80=99t see the benefit of removing this implicit coercion. =E2=80=94 Rob --3738bb6916ca413995d107f501be6a56 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable


On Mon, Jun 2, 2025, at 18:11, Gina P. Banyard wrote:<= /div>
Hello internals= ,

This is the first RFC out of a set of type sy= stem 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 f= ew oddities.

The RFC proposes to deprecate impl= icit 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.

Let me kno= w what you think about it.

Best regards,

Gina P. Banyard


No offense, but this fe= els like it was written by someone who doesn=E2=80=99t use non-strict mo= de very often. The rules around coercion are pretty simple and well docu= mented. Further, this makes a ton of shorthand nearly impossible =E2=80=94= the manual casting to bool in strict mode is one of the most annoying c= asts someone has to do (and people screw up order of operations all the = time leading to subtle bugs worse than coercion). Bringing this into all= of php is probably not a good idea. 

Type juggling of strings to bool is similarly erro= r-prone. The strings "" and "0" are converted to false, but "false", " "= , and other strings which an (int) cast converts to 0 are coerced to tru= e.

If I understand correctly, you = are saying it is weird why the bytes 66 61 6C 73 65 are =E2=80=9Ctr= ue=E2=80=9D and 30 is a special case, but not 20? If I remembe= r my history correctly, 30 is special-cased because forms used to send =E2= =80=9C0=E2=80=9D on checkboxes (if it sent it at all; it changed from de= cade to decade).

I don=E2=80=99t see the benefi= t of removing this implicit coercion.

=E2=80=94 Rob
--3738bb6916ca413995d107f501be6a56--