Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 39f0438

Browse filesBrowse files
author
Robin Chalas
committed
bug symfony#25604 Add check for SecurityBundle in createAccessDeniedException (FGM)
This PR was submitted for the 4.0 branch but it was squashed and merged into the 3.4 branch instead (closes symfony#25604). Discussion ---------- Add check for SecurityBundle in createAccessDeniedException | Q | A | ------------- | --- | Branch? | 4.0 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | symfony#25595 | License | MIT | Doc PR | n.a. Commits ------- a013c01 Add check for SecurityBundle in createAccessDeniedException
2 parents 89903e1 + a013c01 commit 39f0438
Copy full SHA for 39f0438

File tree

Expand file treeCollapse file tree

1 file changed

+6
-0
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+6
-0
lines changed

‎src/Symfony/Bundle/FrameworkBundle/Controller/ControllerTrait.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Controller/ControllerTrait.php
+6Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,10 +366,16 @@ protected function createNotFoundException($message = 'Not Found', \Exception $p
366366
*
367367
* @return AccessDeniedException
368368
*
369+
* @throws \LogicException If SecurityBundle is not available
370+
*
369371
* @final since version 3.4
370372
*/
371373
protected function createAccessDeniedException($message = 'Access Denied.', \Exception $previous = null)
372374
{
375+
if (!class_exists(AccessDeniedException::class)) {
376+
throw new \LogicException('You can not use the "createAccessDeniedException" method if the SecurityBundle is not registered in your application. Try running "composer require security-core".');
377+
}
378+
373379
return new AccessDeniedException($message, $previous);
374380
}
375381

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.