Skip to content

Commit

Permalink
Merge branch 'PHP-8.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
devnexen committed Jul 3, 2024
2 parents d80be78 + 15bea9e commit 0410bf4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
4 changes: 4 additions & 0 deletions ext/standard/array.c
Original file line number Diff line number Diff line change
Expand Up @@ -2996,6 +2996,10 @@ PHP_FUNCTION(range)
step = Z_LVAL_P(user_step);
/* We only want positive step values. */
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;
step *= -1;
}
Expand Down
12 changes: 12 additions & 0 deletions ext/standard/tests/array/gh14775.phpt
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 0410bf4

Please sign in to comment.