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 a013c01

Browse filesBrowse files
fgmRobin Chalas
authored and
Robin Chalas
committed
Add check for SecurityBundle in createAccessDeniedException
1 parent 89903e1 commit a013c01
Copy full SHA for a013c01

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.