Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[BrowserKit] redirectCount not beeing reset when throwing the "The maximum number (%d) of redirections was reached." exception #23197

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
hvanoch opened this issue Jun 15, 2017 · 0 comments

Comments

@hvanoch
Copy link
Contributor

hvanoch commented Jun 15, 2017

Q A
Bug report? yes
Feature request? no
BC Break report? no
RFC? yes
Symfony version 2.8.22

When catching the exception below and you still want to reuse the client every new redirect fails as the counter has not reset.

        if (-1 !== $this->maxRedirects) {
            if ($this->redirectCount > $this->maxRedirects) {
                throw new \LogicException(sprintf('The maximum number (%d) of redirections was reached.', $this->maxRedirects));
            }
        }
fabpot added a commit that referenced this issue Jun 15, 2017
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
@fabpot fabpot closed this as completed Jun 15, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants