Re: [RFC] Throw ValueError for invalid characters in number base functions
| From: | Sjoerd Langkemper | Date: | Wed, 02 Sep 2026 11:49:35 +0000 |
| Subject: | Re: [RFC] Throw ValueError for invalid characters in number base functions | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-132409@lists.php.net to get a copy of this message | ||
On Mon, Aug 31, 2026, at 11:05, Tim Düsterhus wrote:
> > This will throw an error for octdec, hexdec, bindec and base_convert on
> > invalid input.
>
> I'm not sure ValueError is the correct throwable to use here ... It should thus
> use something from the Exception hierarchy.
I am considering this.
Would it be InvalidCharForNumberBaseException extends Exception, or should it be more hierarchical
(InvalidCharForNumberBaseException extends ValueException extends RuntimeException extends
Exception)?
RangeException from SPL seems useful, but we can't use that because it is in another extension,
right?
Regards,
Sjoerd Langkemper