mirror of
https://github.com/php/php-src.git
synced 2025-08-15 13:38:49 +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
|
@ -4147,17 +4147,19 @@ static zend_result zend_compile_func_defined(znode *result, zend_ast_list *args)
|
|||
}
|
||||
/* }}} */
|
||||
|
||||
static zend_result zend_compile_func_chr(znode *result, zend_ast_list *args) /* {{{ */
|
||||
static zend_result zend_compile_func_chr(znode *result, const zend_ast_list *args) /* {{{ */
|
||||
{
|
||||
|
||||
if (args->children == 1 &&
|
||||
args->child[0]->kind == ZEND_AST_ZVAL &&
|
||||
Z_TYPE_P(zend_ast_get_zval(args->child[0])) == IS_LONG) {
|
||||
|
||||
zend_long c = Z_LVAL_P(zend_ast_get_zval(args->child[0])) & 0xff;
|
||||
|
||||
zval *zint;
|
||||
if (
|
||||
args->children == 1
|
||||
&& args->child[0]->kind == ZEND_AST_ZVAL
|
||||
&& (zint = zend_ast_get_zval(args->child[0]))
|
||||
&& Z_TYPE_P(zint) == IS_LONG
|
||||
&& Z_LVAL_P(zint) >= 0
|
||||
&& Z_LVAL_P(zint) <= 255
|
||||
) {
|
||||
result->op_type = IS_CONST;
|
||||
ZVAL_CHAR(&result->u.constant, c);
|
||||
ZVAL_CHAR(&result->u.constant, Z_LVAL_P(zint));
|
||||
return SUCCESS;
|
||||
} else {
|
||||
return FAILURE;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue