Skip to content
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

Error 500 instead of 403 if previous exception is provided to AccessDeniedException #9544

Closed
yannickroger opened this issue Nov 20, 2013 · 2 comments
Labels

Comments

@yannickroger
Copy link

In a controller, add the following code:

$e = new Exception();
throw new AccessDeniedException('Access Denied', $e);

An error 500 should be returned instead of a 403.

@jakzal
Copy link
Contributor

jakzal commented Nov 20, 2013

I just tested it and I'm getting a 500 error every time, no matter if there's a previous exception or not (tested on latest master).

@yannickroger
Copy link
Author

I am using the 2.3 branch btw.

karion added a commit to karion/symfony that referenced this issue Dec 19, 2013
Error 500 instead of 403 if previous exception is provided to
AccessDeniedException
fabpot added a commit that referenced this issue Dec 29, 2013
…eniedException if is not first exception (fabpot)

This PR was merged into the 2.3 branch.

Discussion
----------

[Security] Fix ExceptionListener to catch correctly AccessDeniedException if is not first exception

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #9544, #8467?, #9823
| License       | MIT
| Doc PR        |

Same as #9823 but with some refactoring of the code and with some unit tests.

When merging to 2.4, the unit tests can be simplified a bit.

Commits
-------

172fd63 [Security] made code easier to understand, added some missing unit tests
616b6c5 [Security] fixed error 500 instead of 403 if previous exception is provided to AccessDeniedException
@fabpot fabpot closed this as completed Dec 29, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants