Re: [RFC] Throw ValueError for invalid characters in number base functions

From: Date: Thu, 24 Sep 2026 12:09:01 +0000
Subject: Re: [RFC] Throw ValueError for invalid characters in number base functions
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-132622@lists.php.net to get a copy of this message
On 2026-09-24 19:48, Sjoerd Langkemper wrote:
Hi Morgan, You asked a question about this RFC: https://wiki.php.net/rfc/ throw_error_for_invalid_characters_for_number_base <https:// wiki.php.net/rfc/throw_error_for_invalid_characters_for_number_base> On Thu, Sep 3, 2026, at 13:41, Morgan wrote:
Just incidentally, does this list of functions include intval()?
I didn't respond to this as I didn't think it was an legimitate question. However, if I misunderstood you or if you have some additional thoughts about this please eloborate. Regards, Sjoerd
Yes, it's a legitimate question. Will, for example, intval('hello world', 20) throw? Its current behaviour is to silently truncate at the first character that's invalid in the specified base and convert what's left. In the above example it returns 354, the value of intval('he', 20). I note that intval() doesn't currently issue a deprecation warning, but on the other hand the function isn't mentioned at all in the earlier RFC either. Morgan

« previous php.internals (#132622) next »