File tree Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -36,3 +36,7 @@ Feature: JSON API pagination handling
36
36
Scenario : Get an error when provided page number is not valid
37
37
When I send a "GET" request to "/dummies?page[page]=0"
38
38
Then the response status code should be 400
39
+
40
+ Scenario : Get an error when provided page number is too large
41
+ When I send a "GET" request to "/dummies?page[page]=9223372036854775807"
42
+ Then the response status code should be 400
Original file line number Diff line number Diff line change @@ -91,7 +91,13 @@ public function getOffset(string $resourceClass = null, string $operationName =
91
91
return ($ offset = ($ context ['count ' ] ?? 0 ) - $ last ) < 0 ? 0 : $ offset ;
92
92
}
93
93
94
- return ($ this ->getPage ($ context ) - 1 ) * $ limit ;
94
+ $ offset = ($ this ->getPage ($ context ) - 1 ) * $ limit ;
95
+
96
+ if (!\is_int ($ offset )) {
97
+ throw new InvalidArgumentException ('Page parameter is too large. ' );
98
+ }
99
+
100
+ return $ offset ;
95
101
}
96
102
97
103
/**
You can’t perform that action at this time.
0 commit comments