summaryrefslogtreecommitdiff
path: root/vendor/aws/aws-sdk-php/src/ResultPaginator.php
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2023-10-20 16:44:35 +0300
committerAndrew Dolgov <[email protected]>2023-10-20 16:44:35 +0300
commit8bec661288b276c98bdb0e773e5f4d5275dc4c87 (patch)
tree8617ebe581c62fc46a7881aa61801ebce9d3c603 /vendor/aws/aws-sdk-php/src/ResultPaginator.php
parent540438c2eb5452bacad30c247906bfa287f2da1d (diff)
update AWK SDKHEADmaster
Diffstat (limited to 'vendor/aws/aws-sdk-php/src/ResultPaginator.php')
-rw-r--r--vendor/aws/aws-sdk-php/src/ResultPaginator.php16
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;
}