Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:129909 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 AB7931A00BC for ; Sat, 24 Jan 2026 13:37:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1769261835; bh=Ia2D185cXpOzlMM2acxaKRmUo1N2SpHU/xRlKEgte5g=; h=Date:To:From:Cc:Subject:In-Reply-To:References:From; b=JcKxE0w/6QopVKDE/p4TbmzmZOdGWAqT4chKXHut6hQ+aOabTrxh8p9EgDJkh8YOO wy0zM9+XhzTyoS0O1wr4kHcXPCxjzALvwgH6mp9yE0d+YMf7vrcTns6yBZHlsrKFSB ZU2TEpIMqP1Fa9O07IdLNfEry1RIswmRZkM4svezv6z25doTOVSvbCqwqwq06JZ9iN B4dnmyCHnfoegkib6HEx/kvfHxGVo2CKBtPW77nOH20gwZutkvFD84yHhP6aYUGp5l iMwd6x7um3QmqYdwcSxPZeYivZSKpdtJwBei4xU5VKtvImRo/6hlYoV8Syn17ao4Jq S0+IybjWLnxwQ== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 2BCDE180068 for ; Sat, 24 Jan 2026 13:37:13 +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_PASS,RCVD_IN_DNSWL_LOW, 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: No X-Envelope-From: Received: from mail-4323.protonmail.ch (mail-4323.protonmail.ch [185.70.43.23]) (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 ; Sat, 24 Jan 2026 13:37:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gpb.moe; s=protonmail2; t=1769261826; x=1769521026; bh=Ia2D185cXpOzlMM2acxaKRmUo1N2SpHU/xRlKEgte5g=; 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=Dle7Mxhmrt6wx5zTsvWup4/eI4oomq83GNldpBNtKbZwqiDrEVCMLpfm6LgfSH48Y wveCir8qnGF4Bobc5kXDlnhAZYSXUCgOe08LjwzyhDtikRX8OCQ26j0qmvQTkoufoD KIxLasC+py6KSd9/e/NRnVNs+2UJxUPS4Il9ceK53Q/sV0neBGkAJjs/uID8lD4iQA g1mcsFgJ+XFCNCmnxzBsF26jVy+oUsb9QVZi3UZBSnz6OzaKUbsp2dDiXiapZ/IXLZ VBsjHo1dPg2sCffutIGfLdE7ydLhY9RyjKLJ6cGTYFnqIw2uNg+AVIAtDsGxcbx+QC OOj0wIKbgzY8Q== Date: Sat, 24 Jan 2026 13:37:00 +0000 To: Alexandre Daubois Cc: PHP internals list Subject: Re: [PHP-DEV] [RFC] Deprecate Fuzzy Type Casts and Allow Stringable in Strict Mode Message-ID: In-Reply-To: References: Feedback-ID: 96993444:user:proton X-Pm-Message-ID: 1314c2741c5772435a762dccab6376e2bff3f95e 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: internals@gpb.moe ("Gina P. Banyard") On Friday, 23 January 2026 at 10:51, Alexandre Daubois wrote: > Hello everyone, >=20 > 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. >=20 > RFC: https://wiki.php.net/rfc/deprecate-fuzzy-casts >=20 > Thanks, >=20 > =E2=80=94 Alexandre Daubois Hello Alexandre, I know we had some preliminary offline discussions about this RFC, but having the final document in front of me, I feel you are mixing 3 diffe= rent RFCs in one. And none of them are fully fleshed out within this single document. I see that you've already replied to Larry that you're going to spin out th= e Stringable change into its own RFC, which I think is good. However, even when just talking about the casting operators the discussion = is muddled. You are grouping the transformation between scalar types (string, int, floa= t, bool) and how they can truncate/coerce data with a possible loss of info= rmation on one hand, and talking about the (object) cast on the other hand, which is a cast to a= "structured" type. While I agree that the (object) cast is definitely strange on scalar types,= I also don't see why keeping (object) for casting arrays makes that much m= ore sense? And why do you not talk about the (array) cast at all? Both of these casts are two sides of the same coin, and IMHO should both be= deprecated outright, due to their confusing semantics. Yes, I know Symfony uses the (array) cast a lot, but the get_mangled_object= _vars() function has existed long enough for it to replace the usage of (ar= ray) on objects. And even the aspect about the fuzzy casts feels incomplete to me, you do no= t talk about the (bool) or (string) cast (and relevant boolval()/strval() f= unctions) are these affected by your RFC change? Because casting a float to a string depends on the precision INI setting, s= ee: https://3v4l.org/5GJWh Which _feels_ like a fuzzy cast to me, although this is just PHP's usual fl= oat to string coercion semantics. You also mention that the `(int) 12.5` fuzzy cast is covered by my "Depreca= te implicit non-integer-compatible float to int conversions" RFC [1], but this is not the case. See: https://3v4l.org/3AZOd#vnull As I specifically did *not* affect the behaviour of the casting operators i= n this RFC, nor in my prior "Saner numeric strings" RFC. The reason being is that many people were concerned about the impact on leg= acy codebase, or codebase that utilized the long-standing truncation behavi= our. Moreover, at no point do you describe if NULL would still be accepted for t= ype casting. Because if you do, then it would not follow the behaviour of scalar type ch= ecks which rejects NULL. And what would happen to these scalar casts if a different version of the "= Deprecate type juggling to and from bool type within the function type jugg= ling context" RFC [3] passes? Overall, it feels this proposal is trying to work around the "mindless" usa= ge of strict_types, to which my opinion and solution is to just remove it. I very much understand the appeal of trying to fix the problem at the root,= but I'm not sure if this would pass, considering that adding various "parse_T()" functions that exposes the ZPP = behaviour might just be more sensible. Best regards, Gina P. Banyard [1] https://wiki.php.net/rfc/implicit-float-int-deprecate [2] https://wiki.php.net/rfc/saner-numeric-strings [3] https://wiki.php.net/rfc/deprecate-function-bool-type-juggling