Re: [RFC] Deprecate Fuzzy Type Casts and Allow Stringable in Strict Mode
| From: | Rowan Tommins [IMSoP] | Date: | Fri, 23 Jan 2026 17:42:46 +0000 |
| Subject: | Re: [RFC] Deprecate Fuzzy Type Casts and Allow Stringable in Strict Mode | ||
| References: | 1 2 3 4 5 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-129906@lists.php.net to get a copy of this message | ||
On 23 January 2026 17:05:09 GMT, Alexandre Daubois <alex.daubois+php@gmail.com> wrote:
>3. Developers who truly need to extract integers from strings like
>"123abc" can use explicit parsing. This makes the intent explicit:
>"I'm extracting a number from potentially dirty input", rather than
>relying on cast semantics that differ from type validation.
The existing functions *are* explicit. They have *always* had the semantics of "try to extract
an integer from this value". They are not "problematic", they are a perfectly
reasonable feature for the language to include.
The *new* functionality needed is "validate that this value is int-like, and only give me an
integer if it is".
I don't think we should repurpose widely-used syntax for a different use case. If we want new
functionality, with new semantics, we should add new syntax for that.
Rowan Tommins
[IMSoP]