diff options
author | Andrew Dolgov <[email protected]> | 2023-10-20 16:44:35 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2023-10-20 16:44:35 +0300 |
commit | 8bec661288b276c98bdb0e773e5f4d5275dc4c87 (patch) | |
tree | 8617ebe581c62fc46a7881aa61801ebce9d3c603 /vendor/aws/aws-sdk-php/src/ResultPaginator.php | |
parent | 540438c2eb5452bacad30c247906bfa287f2da1d (diff) |
Diffstat (limited to 'vendor/aws/aws-sdk-php/src/ResultPaginator.php')
-rw-r--r-- | vendor/aws/aws-sdk-php/src/ResultPaginator.php | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/vendor/aws/aws-sdk-php/src/ResultPaginator.php b/vendor/aws/aws-sdk-php/src/ResultPaginator.php index 2c5ec5c..2b0c7c9 100644 --- a/vendor/aws/aws-sdk-php/src/ResultPaginator.php +++ b/vendor/aws/aws-sdk-php/src/ResultPaginator.php @@ -127,10 +127,26 @@ class ResultPaginator implements \Iterator } if ($this->nextToken || !$this->requestCount) { + //Forward/backward paging can result in a case where the last page's nextforwardtoken + //is the same as the one that came before it. This can cause an infinite loop. + $hasBidirectionalPaging = $this->config['output_token'] === 'nextForwardToken'; + if ($hasBidirectionalPaging && $this->nextToken) { + $tokenKey = $this->config['input_token']; + $previousToken = $this->nextToken[$tokenKey]; + } + $this->result = $this->client->execute( $this->createNextCommand($this->args, $this->nextToken) ); + $this->nextToken = $this->determineNextToken($this->result); + + if (isset($previousToken) + && $previousToken === $this->nextToken[$tokenKey] + ) { + return false; + } + $this->requestCount++; return true; } |