File tree Expand file tree Collapse file tree 3 files changed +21
-1
lines changed
Expand file tree Collapse file tree 3 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -29,7 +29,11 @@ PHP NEWS
2929 (David Carlier)
3030
3131- Shmop:
32- . Fixed bug GH-14537 (shmop Windows 11 crashes the process). (nielsdos)
32+ . Fixed bug GH-14537 (shmop Windows 11 crashes the process). (nielsdos)
33+
34+ - Standard:
35+ . Fixed bug GH-14775 (range function overflow with negative step argument).
36+ (David Carlier)
3337
343820 Jun 2024, PHP 8.3.9
3539
Original file line number Diff line number Diff line change @@ -2887,6 +2887,10 @@ PHP_FUNCTION(range)
28872887 step = Z_LVAL_P (user_step );
28882888 /* We only want positive step values. */
28892889 if (step < 0 ) {
2890+ if (UNEXPECTED (step == ZEND_LONG_MIN )) {
2891+ zend_argument_value_error (3 , "must be greater than " ZEND_LONG_FMT , step );
2892+ RETURN_THROWS ();
2893+ }
28902894 is_step_negative = true;
28912895 step *= -1 ;
28922896 }
Original file line number Diff line number Diff line change 1+ --TEST--
2+ GH-14775: Range negative step overflow
3+ --FILE--
4+ <?php
5+ $ var = -PHP_INT_MAX - 1 ;
6+ try {
7+ range ($ var ,1 ,$ var );
8+ } catch (\ValueError $ e ) {
9+ echo $ e ->getMessage () . PHP_EOL ;
10+ }
11+ --EXPECTF --
12+ range(): Argument #3 ($step) must be greater than %s
You can’t perform that action at this time.
0 commit comments