Merge branch 'PHP-8.3'

This commit is contained in:
David Carlier 2024-07-03 18:57:54 +01:00
commit 0410bf4147
No known key found for this signature in database
GPG key ID: D308BD11AB42D054
2 changed files with 16 additions and 0 deletions

View file

@ -2996,6 +2996,10 @@ PHP_FUNCTION(range)
step = Z_LVAL_P(user_step); step = Z_LVAL_P(user_step);
/* We only want positive step values. */ /* We only want positive step values. */
if (step < 0) { if (step < 0) {
if (UNEXPECTED(step == ZEND_LONG_MIN)) {
zend_argument_value_error(3, "must be greater than " ZEND_LONG_FMT, step);
RETURN_THROWS();
}
is_step_negative = true; is_step_negative = true;
step *= -1; step *= -1;
} }

View file

@ -0,0 +1,12 @@
--TEST--
GH-14775: Range negative step overflow
--FILE--
<?php
$var = -PHP_INT_MAX - 1;
try {
range($var,1,$var);
} catch (\ValueError $e) {
echo $e->getMessage() . PHP_EOL;
}
--EXPECTF--
range(): Argument #3 ($step) must be greater than %s