Re: [RFC] Deprecate Fuzzy Type Casts and Allow Stringable in Strict Mode

From: Date: Fri, 23 Jan 2026 14:55:58 +0000
Subject: Re: [RFC] Deprecate Fuzzy Type Casts and Allow Stringable in Strict Mode
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-129893@lists.php.net to get a copy of this message
On 23/01/2026 16:17, Alexandre Daubois wrote:
I understand the concern about legacy code. However, if code relies on (int) "123abc" silently returning 123, this represents a data integrity issue that would benefit from being made explicit. The deprecation period exists specifically to help identify and address these cases.
Hi, Alexandre While I agree that this code likely indicates some form of broken logic, this code still needs a clear migration path, so introducing something like fuzzy_int() function with the old behavior I'd say is expected. Second, there should be a time frame where an old and a new way can coexist so deprecating it in 8.x feels a bit rushed. To me a perfect migration would be something like 8.6: introduce fuzzy_int or even a family of functions (fuzzy_float?) 9.1: deprecate 10.0: TypeError -- Anton

« previous php.internals (#129893) next »