Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:129892 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 4FF611A00BC for ; Fri, 23 Jan 2026 14:54:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1769180100; bh=un4ruWICJFhPvN/S13FDoUdJAEpZFriUdp5fWmzdNRg=; h=Date:From:To:Subject:In-Reply-To:References:From; b=frJnhJdO0JGsaANEZJVnEkrU3gQzxUMP+Ab8HtZ+29UUk6KSUEkL31VAyxkAYh4Da XSkyABwJJRsZcd18l4tUkR69kmdZ0ankieEeKx7sq7jECX0julkEVrSrHB6MEy0E+3 VXnzG/Ye/tISAjvF171mKqDD5x/wfFHjEvqoAe7OT2H4bvEncq1IztOv1pIO8Ijjyq RpOLax349T68GP7F4kBEMWgu6diqtG0cDxQsjw+mAIx2f36Gq09LqXtSQ15DF0GJn0 JjwZDloVZraR1YKlnAHiiee20KS7Pygjxm+MkQ8FUWl4Kuj/nhcId+iVIg5WAy24pG Zl7IDtRghjLYQ== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id C8CC8180503 for ; Fri, 23 Jan 2026 14:54:59 +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=-0.1 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_MISSING,RCVD_IN_DNSWL_LOW, SPF_HELO_PASS,SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: No X-Envelope-From: Received: from fhigh-b8-smtp.messagingengine.com (fhigh-b8-smtp.messagingengine.com [202.12.124.159]) (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 ; Fri, 23 Jan 2026 14:54:59 +0000 (UTC) Received: from phl-compute-05.internal (phl-compute-05.internal [10.202.2.45]) by mailfhigh.stl.internal (Postfix) with ESMTP id 04C4F7A012F for ; Fri, 23 Jan 2026 09:54:53 -0500 (EST) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-05.internal (MEProxy); Fri, 23 Jan 2026 09:54:54 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rwec.co.uk; h=cc :content-transfer-encoding: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=1769180093; x=1769266493; bh=un4ruWICJFhPvN/S13FDoUdJAEpZFriUdp5fWmzdNRg=; b= eDL9MU+rAR5YQFJcw0MzQuQZUUTEeRK0u6QOJng2vacfwluEu1bmeb3WzOy+wQ8v hOVbypTnZiktroEP9se/2gU+3fQzpPAnoxTdFvxBxAitK2Jk4k30lqiDp+Bjziro ziyYoxmGjeNLC+OW0ruvbnkZDAJq/yu2kA9nFGhomiBQGNvxIyISrokIxBeCceoC o9q7WW5TRr4SUK2pssHdpaJ7MwfsP2IIonUGzgFxSCH5pbgYZK/iSql+SrgE3AqW d/xRQVwjDy7p8m/M1acfCIr+1NGrv4QzriMx3ojvvZ/KipfpDQl4B1NPssoAvNzH X59gHWn5wHHSgpJ0Vj3Hhw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding: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=fm2; t=1769180093; x=1769266493; bh=u n4ruWICJFhPvN/S13FDoUdJAEpZFriUdp5fWmzdNRg=; b=wnIioyy+Jb7jL/TdK Qg029oKfJRk1vX4DHLHdrA+DHAVamd/2vVx3etBnISuQE0xeKaqGyo0umR/itzDn qK7bHCjsSIhLvycXGcADTsa10K/hQunCwreGa/OKT9eozk9E2IzzU+RRT/+luejZ 77nnB8/X2mL0dAdVrbfj+8G6Ly4Nx7gskLjsd6g2oisxa8K8aJNpQfr5RiWhW8cZ 2vKHISqG7mw1krlVwGtKJD1MeH6LsQpU56v7hzQma5C/eMgsNPr+52mlTZF5Wf78 gqoGzQkhdvBUo6by1iYHMtqLSltvIDa7gZ6dDDZHwNpMTs+C8NGFj/Pqsk+B9OH5 rZkdg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddugeelfeefucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhepfffhvffufggjfhfkgggtgfesthhqmhdttderjeenucfhrhhomhepfdftohifrghn ucfvohhmmhhinhhsucglkffoufhorfgnfdcuoehimhhsohhprdhphhhpsehrfigvtgdrtg hordhukheqnecuggftrfgrthhtvghrnhepledvueehtdehudduleefhffgjefhffdvleej fefgueeigfeigfdvhefhfeeuvddvnecuffhomhgrihhnpehphhhprdhnvghtnecuvehluh hsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepihhmshhophdrphhh phesrhifvggtrdgtohdruhhkpdhnsggprhgtphhtthhopedupdhmohguvgepshhmthhpoh huthdprhgtphhtthhopehinhhtvghrnhgrlhhssehlihhsthhsrdhphhhprdhnvght X-ME-Proxy: Feedback-ID: id5114917:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Fri, 23 Jan 2026 09:54:52 -0500 (EST) Date: Fri, 23 Jan 2026 14:54:49 +0000 To: PHP internals list Subject: =?US-ASCII?Q?Re=3A_=5BPHP-DEV=5D_=5BRFC=5D_Deprecate_Fuzzy_Type_?= =?US-ASCII?Q?Casts_and_Allow_Stringable_in_Strict_Mode?= User-Agent: K-9 Mail for Android In-Reply-To: References: Message-ID: Precedence: list list-help: list-unsubscribe: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: imsop.php@rwec.co.uk ("Rowan Tommins [IMSoP]") On 23 January 2026 10:48:45 GMT, Alexandre Daubois wrote: >Hello everyone, > >Before going further with our already under discussion RFC about >nullable casts, Nicolas Grekas and I would like to present this new >RFC about deprecating fuzzy casts, and adding support for Stringable >in string parameters when using strict mode=2E > >RFC: https://wiki=2Ephp=2Enet/rfc/deprecate-fuzzy-casts Hi Alexandre, I am strongly against the Stringable part of this=2E It would mean users who have explicitly asked for no type coercion would g= et silent type coercion=2E It would mean that a string parameter in mode 1 = would still reject an integer 42, but would *accept* new BcMath\Number(42)= =2E I can't see how that makes sense=2E - My thoughts on "fuzzy casts" are more nuanced=2E I do think PHP needs some functions or syntax for "validating" casts, but = I'm not convinced they should *replace* our existing casts=2E Not only would it break the huge amount of code out there which assumes th= at a cast will always return a result rather than an error, I think that is= a perfectly valid use case=2E It is often useful to say "take this string,= and return an integer if it's int-like, or a default value of 0 if not"=2E= Although they're not perfect, that's roughly what our existing casts provi= de=2E I can see an argument for making (int)"123hello" evaluate to 0, rather tha= n 123; but even that would be a confusing BC break for a lot of application= s=2E As I've said elsewhere, I think the right approach to this is to design a = new set of cast operations, with a more extendable syntax=2E They can have = more clearly defined rules for "int-like string" etc, and different modes/v= ariants for use cases like "error on failure" vs "default value on failure"= =2E Rowan Tommins [IMSoP]