Hi On 2026-08-28 10:24, Sjoerd Langkemper wrote:
Next Friday I'll open the vote for the RFC for Throw ValueError for invalid characters in number base functions.
From what I see this is the first email regarding this RFC, the archives do not show any previous emails in the discussion thread: https://news-web.php.net/php.internals/132379. New RFCs require a minimum discussion period of 14 days before they may go to voting.
This will throw an error for octdec, hexdec, bindec and base_convert on invalid input. We already agreed to this before (in RFC base_convert changes), so this RFC is not really controversial but more about following the right procedure.
I'm not sure ValueError is the correct throwable to use here: I believe passing “user-provided” inputs to these methods might be an expected use case, where developers would then be interested in catching the resulting exception as an implicit validation mechanism. This is also acknowledged by the RFC:
If invalid characters are passed, a ValueError will now be thrown, which must be handled using try/catch blocks if invalid inputs are expected from untrusted sources.
The Error hierarchy is not intended to be caught, though. It should thus use something from the Exception hierarchy.
Best regards Tim Düsterhus
