mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
ext/standard: Deprecate passing integers outside the interval [0, 255] to chr() (#19441)
RFC: https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_passing_integers_outside_the_interval_0_255_to_chr
This commit is contained in:
parent
6009b8a100
commit
cab46b27b9
15 changed files with 139 additions and 160 deletions
|
@ -2665,6 +2665,12 @@ PHP_FUNCTION(chr)
|
|||
Z_PARAM_LONG(c)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
if (UNEXPECTED(c < 0 || c > 255)) {
|
||||
php_error_docref(NULL, E_DEPRECATED,
|
||||
"Providing a value not in-between 0 and 255 is deprecated,"
|
||||
" this is because a byte value must be in the [0, 255] interval."
|
||||
" The value used will be constrained using %% 256");
|
||||
}
|
||||
c &= 0xff;
|
||||
RETURN_CHAR(c);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue