Re: [RFC] Throw ValueError for i nvalid characters in number base functions
| From: | Rowan Tommins [IMSoP] | Date: | Wed, 02 Sep 2026 12:12:13 +0000 |
| Subject: | Re: [RFC] Throw ValueError for i nvalid characters in number base functions | ||
| References: | 1 2 3 4 5 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-132410@lists.php.net to get a copy of this message | ||
On 2 September 2026 12:49:35 BST, Sjoerd Langkemper <sjoerd-php@linuxonly.nl> wrote:
>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?
Both ValueException and RuntimeException are in SPL, which is always enabled, so there's no
*practical* problem using them.
However, the policy Tim linked to lays out the details of how exceptions should be defined, and says
the base should be \Exception, then something extension-specific, *not* any of the SPL exceptions.
This is a slightly complex case, because there's no extension or obvious group of functions to
name the base under. Possibly a BaseConversionException?
Regards,
Rowan Tommins
[IMSoP]