RE: [PHP-DEV] [RFC] [VOTE] Throw exception for invalid characters in number base functions
| From: | CHU Zhaowei | Date: | Wed, 21 Oct 2026 12:42:28 +0000 |
| Subject: | RE: [PHP-DEV] [RFC] [VOTE] Throw exception for invalid characters in number base functions | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-132887@lists.php.net to get a copy of this message | ||
Hi,
I've voted against on this RFC, and the only reason is the choice of a
generic \Exception.
The original Base Convert Improvements RFC (
<https://wiki.php.net/rfc/base_convert_improvements>
https://wiki.php.net/rfc/base_convert_improvements)
already set out the
intended path:
> This vote will be to raise a E_DEPRECATED warning for PHP 7.4. Raising to
be an
InvalidArgumentException in PHP 8
I agree with moving away from ValueError for the reasons given in the RFC.
However, InvalidArgumentException, which was the exception originally
agreed upon, wasn't brought up.
The Rejected Features section notes that SPL exceptions shouldn't be thrown
from ext/standard. If that's the blocker, I'd rather see it resolved (or a
dedicated exception class introduced) than have a core function throw a bare
\Exception, which users can only catch together with every other exception.
Regards,
CHU Zhaowei