Repository navigation
Conversation
|
Hi @Sjord. My main concern is process about your PR is effectively phase 2 of the 2018 base_convert_improvements RFC (the 8.0 exception that never shipped), It also overlaps your own precision-loss thread; both touch _php_math_basetozval, better designed together. |
|
I also mailed the internals mailing list:
|
453362a to
8e8a8c1
Compare
|
The RFC was accepted. |
This is about the situation where a character is not within the
specified number base. E.g. only 0-9, a-f are allowed for hexadecimal,
so what should `hexdec('z')` do?
In the past, such characters were silently ignored. Since PHP 7.4 a
deprecation notice would be generated. This commit changes that to a
Exception.
RFC: https://wiki.php.net/rfc/throw_error_for_invalid_characters_for_number_base
8e8a8c1 to
34b831d
Compare
| if (invalidchars > 0) { | ||
| zend_error(E_DEPRECATED, "Invalid characters passed for attempted conversion, these have been ignored"); | ||
| if (invalidchars) { | ||
| zend_throw_exception_ex(NULL, 0, "Invalid characters passed for attempted conversion"); |
There was a problem hiding this comment.
nit: you can just use zend_throw_exception here I think
This is about the situation where a character is not within the specified number base. E.g. only 0-9, a-f are allowed for hexadecimal, so what should
hexdec('z')do?In the past, such characters were silently ignored. Since PHP 7.4 a deprecation notice would be generated. This PR changes that to a
ValueErrorException.RFC: https://wiki.php.net/rfc/throw_error_for_invalid_characters_for_number_base
Earlier RFC: https://wiki.php.net/rfc/base_convert_improvements