Skip to content

Commit b8c94d0

Browse files
committed
bug #23199 Reset redirectCount when throwing exception (hvanoch)
This PR was merged into the 2.7 branch. Discussion ---------- Reset redirectCount when throwing exception | Q | A | ------------- | --- | Branch? | 2.7 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #23197 | License | MIT When catching the exception throw when exceeding the redirect limit, all new request which results in a redirect fail. By resetting the redirectCount we can still use the same client instance. Commits ------- 83fd578 Reset redirectCount when throwing exception
2 parents 511905d + 83fd578 commit b8c94d0

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/Symfony/Component/BrowserKit/Client.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -448,6 +448,7 @@ public function followRedirect()
448448

449449
if (-1 !== $this->maxRedirects) {
450450
if ($this->redirectCount > $this->maxRedirects) {
451+
$this->redirectCount = 0;
451452
throw new \LogicException(sprintf('The maximum number (%d) of redirections was reached.', $this->maxRedirects));
452453
}
453454
}

0 commit comments

Comments
 (0)