File tree 3 files changed +21
-1
lines changed 3 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -29,7 +29,11 @@ PHP NEWS
29
29
(David Carlier)
30
30
31
31
- 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)
33
37
34
38
20 Jun 2024, PHP 8.3.9
35
39
Original file line number Diff line number Diff line change @@ -2887,6 +2887,10 @@ PHP_FUNCTION(range)
2887
2887
step = Z_LVAL_P (user_step );
2888
2888
/* We only want positive step values. */
2889
2889
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
+ }
2890
2894
is_step_negative = true;
2891
2895
step *= -1 ;
2892
2896
}
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