From d672f81655c396175dcb431796c1e801bbaa4f7e Mon Sep 17 00:00:00 2001 From: Steve Nebes Date: Fri, 19 Jul 2019 10:12:25 -0500 Subject: [PATCH 1/7] [@IsGranted] Updated exception handling when the $subject is an array of values --- EventListener/IsGrantedListener.php | 13 ++++++++++++- Tests/EventListener/IsGrantedListenerTest.php | 5 ++++- var/log/console.log | 13 +++++++++++++ 3 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 var/log/console.log diff --git a/EventListener/IsGrantedListener.php b/EventListener/IsGrantedListener.php index 419e9d80..4d72a7a1 100644 --- a/EventListener/IsGrantedListener.php +++ b/EventListener/IsGrantedListener.php @@ -97,6 +97,7 @@ private function getIsGrantedString(IsGranted $isGranted) $attributes = array_map(function ($attribute) { return sprintf('"%s"', $attribute); }, (array) $isGranted->getAttributes()); + if (1 === \count($attributes)) { $argsString = reset($attributes); } else { @@ -104,7 +105,17 @@ private function getIsGrantedString(IsGranted $isGranted) } if (null !== $isGranted->getSubject()) { - $argsString = sprintf('%s, %s', $argsString, $isGranted->getSubject()); + $subjects = \array_map(function ($subject) { + return \sprintf('%s', $subject); + }, (array) $isGranted->getSubject()); + + if (1 === \count($subjects)) { + $subjectString = \reset($subjects); + } else { + $subjectString = \sprintf('[%s]', \implode(', ', $subjects)); + } + + $argsString = sprintf('%s, %s', $argsString, $subjectString); } return $argsString; diff --git a/Tests/EventListener/IsGrantedListenerTest.php b/Tests/EventListener/IsGrantedListenerTest.php index d41e4fd3..21c77ac2 100644 --- a/Tests/EventListener/IsGrantedListenerTest.php +++ b/Tests/EventListener/IsGrantedListenerTest.php @@ -125,7 +125,9 @@ public function testAccessDeniedMessages(array $attributes, $subject, $expectedM // avoid the error of the subject not being found in the request attributes $arguments = []; if (null !== $subject) { - $arguments[$subject] = 'bar'; + foreach ((array) $subject as $value) { + $arguments[$value] = 'bar'; + } } $listener = new IsGrantedListener($this->createArgumentNameConverter($arguments), $authChecker); @@ -146,6 +148,7 @@ public function getAccessDeniedMessageTests() yield [['ROLE_ADMIN'], null, 'Access Denied by controller annotation @IsGranted("ROLE_ADMIN")']; yield [['ROLE_ADMIN', 'ROLE_USER'], null, 'Access Denied by controller annotation @IsGranted(["ROLE_ADMIN", "ROLE_USER"])']; yield [['ROLE_ADMIN', 'ROLE_USER'], 'product', 'Access Denied by controller annotation @IsGranted(["ROLE_ADMIN", "ROLE_USER"], product)']; + yield [['ROLE_ADMIN', 'ROLE_USER'], ['product', 'feature'], 'Access Denied by controller annotation @IsGranted(["ROLE_ADMIN", "ROLE_USER"], [product, feature])']; } /** diff --git a/var/log/console.log b/var/log/console.log new file mode 100644 index 00000000..20a61943 --- /dev/null +++ b/var/log/console.log @@ -0,0 +1,13 @@ +[2019-07-19 14:56:24] request.CRITICAL: Uncaught PHP Exception RuntimeException: "Controller "Tests\Fixtures\ActionArgumentsBundle\Controller\NullableArgumentsController::withoutDefaultAction()" requires that you provide a value for the "$d" argument. Either the argument is nullable and no null value has been provided, no default value has been provided or because there is a non optional argument after this one." at /Users/snebes/Sites/SensioFrameworkExtraBundle/vendor/symfony/http-kernel/Controller/ArgumentResolver.php line 78 {"exception":"[object] (RuntimeException(code: 0): Controller \"Tests\\Fixtures\\ActionArgumentsBundle\\Controller\\NullableArgumentsController::withoutDefaultAction()\" requires that you provide a value for the \"$d\" argument. Either the argument is nullable and no null value has been provided, no default value has been provided or because there is a non optional argument after this one. at /Users/snebes/Sites/SensioFrameworkExtraBundle/vendor/symfony/http-kernel/Controller/ArgumentResolver.php:78)"} [] +[2019-07-19 14:59:10] request.CRITICAL: Uncaught PHP Exception RuntimeException: "Controller "Tests\Fixtures\ActionArgumentsBundle\Controller\NullableArgumentsController::withoutDefaultAction()" requires that you provide a value for the "$d" argument. Either the argument is nullable and no null value has been provided, no default value has been provided or because there is a non optional argument after this one." at /Users/snebes/Sites/SensioFrameworkExtraBundle/vendor/symfony/http-kernel/Controller/ArgumentResolver.php line 78 {"exception":"[object] (RuntimeException(code: 0): Controller \"Tests\\Fixtures\\ActionArgumentsBundle\\Controller\\NullableArgumentsController::withoutDefaultAction()\" requires that you provide a value for the \"$d\" argument. Either the argument is nullable and no null value has been provided, no default value has been provided or because there is a non optional argument after this one. at /Users/snebes/Sites/SensioFrameworkExtraBundle/vendor/symfony/http-kernel/Controller/ArgumentResolver.php:78)"} [] +[2019-07-19 15:00:55] request.CRITICAL: Uncaught PHP Exception RuntimeException: "Controller "Tests\Fixtures\ActionArgumentsBundle\Controller\NullableArgumentsController::withoutDefaultAction()" requires that you provide a value for the "$d" argument. Either the argument is nullable and no null value has been provided, no default value has been provided or because there is a non optional argument after this one." at /Users/snebes/Sites/SensioFrameworkExtraBundle/vendor/symfony/http-kernel/Controller/ArgumentResolver.php line 78 {"exception":"[object] (RuntimeException(code: 0): Controller \"Tests\\Fixtures\\ActionArgumentsBundle\\Controller\\NullableArgumentsController::withoutDefaultAction()\" requires that you provide a value for the \"$d\" argument. Either the argument is nullable and no null value has been provided, no default value has been provided or because there is a non optional argument after this one. at /Users/snebes/Sites/SensioFrameworkExtraBundle/vendor/symfony/http-kernel/Controller/ArgumentResolver.php:78)"} [] +[2019-07-19 15:01:02] request.CRITICAL: Uncaught PHP Exception RuntimeException: "Controller "Tests\Fixtures\ActionArgumentsBundle\Controller\NullableArgumentsController::withoutDefaultAction()" requires that you provide a value for the "$d" argument. Either the argument is nullable and no null value has been provided, no default value has been provided or because there is a non optional argument after this one." at /Users/snebes/Sites/SensioFrameworkExtraBundle/vendor/symfony/http-kernel/Controller/ArgumentResolver.php line 78 {"exception":"[object] (RuntimeException(code: 0): Controller \"Tests\\Fixtures\\ActionArgumentsBundle\\Controller\\NullableArgumentsController::withoutDefaultAction()\" requires that you provide a value for the \"$d\" argument. Either the argument is nullable and no null value has been provided, no default value has been provided or because there is a non optional argument after this one. at /Users/snebes/Sites/SensioFrameworkExtraBundle/vendor/symfony/http-kernel/Controller/ArgumentResolver.php:78)"} [] +[2019-07-19 15:02:08] request.CRITICAL: Uncaught PHP Exception RuntimeException: "Controller "Tests\Fixtures\ActionArgumentsBundle\Controller\NullableArgumentsController::withoutDefaultAction()" requires that you provide a value for the "$d" argument. Either the argument is nullable and no null value has been provided, no default value has been provided or because there is a non optional argument after this one." at /Users/snebes/Sites/SensioFrameworkExtraBundle/vendor/symfony/http-kernel/Controller/ArgumentResolver.php line 78 {"exception":"[object] (RuntimeException(code: 0): Controller \"Tests\\Fixtures\\ActionArgumentsBundle\\Controller\\NullableArgumentsController::withoutDefaultAction()\" requires that you provide a value for the \"$d\" argument. Either the argument is nullable and no null value has been provided, no default value has been provided or because there is a non optional argument after this one. at /Users/snebes/Sites/SensioFrameworkExtraBundle/vendor/symfony/http-kernel/Controller/ArgumentResolver.php:78)"} [] +[2019-07-19 15:02:33] request.CRITICAL: Uncaught PHP Exception RuntimeException: "Controller "Tests\Fixtures\ActionArgumentsBundle\Controller\NullableArgumentsController::withoutDefaultAction()" requires that you provide a value for the "$d" argument. Either the argument is nullable and no null value has been provided, no default value has been provided or because there is a non optional argument after this one." at /Users/snebes/Sites/SensioFrameworkExtraBundle/vendor/symfony/http-kernel/Controller/ArgumentResolver.php line 78 {"exception":"[object] (RuntimeException(code: 0): Controller \"Tests\\Fixtures\\ActionArgumentsBundle\\Controller\\NullableArgumentsController::withoutDefaultAction()\" requires that you provide a value for the \"$d\" argument. Either the argument is nullable and no null value has been provided, no default value has been provided or because there is a non optional argument after this one. at /Users/snebes/Sites/SensioFrameworkExtraBundle/vendor/symfony/http-kernel/Controller/ArgumentResolver.php:78)"} [] +[2019-07-19 15:04:16] request.CRITICAL: Uncaught PHP Exception RuntimeException: "Controller "Tests\Fixtures\ActionArgumentsBundle\Controller\NullableArgumentsController::withoutDefaultAction()" requires that you provide a value for the "$d" argument. Either the argument is nullable and no null value has been provided, no default value has been provided or because there is a non optional argument after this one." at /Users/snebes/Sites/SensioFrameworkExtraBundle/vendor/symfony/http-kernel/Controller/ArgumentResolver.php line 78 {"exception":"[object] (RuntimeException(code: 0): Controller \"Tests\\Fixtures\\ActionArgumentsBundle\\Controller\\NullableArgumentsController::withoutDefaultAction()\" requires that you provide a value for the \"$d\" argument. Either the argument is nullable and no null value has been provided, no default value has been provided or because there is a non optional argument after this one. at /Users/snebes/Sites/SensioFrameworkExtraBundle/vendor/symfony/http-kernel/Controller/ArgumentResolver.php:78)"} [] +[2019-07-19 15:06:14] request.CRITICAL: Uncaught PHP Exception RuntimeException: "Controller "Tests\Fixtures\ActionArgumentsBundle\Controller\NullableArgumentsController::withoutDefaultAction()" requires that you provide a value for the "$d" argument. Either the argument is nullable and no null value has been provided, no default value has been provided or because there is a non optional argument after this one." at /Users/snebes/Sites/SensioFrameworkExtraBundle/vendor/symfony/http-kernel/Controller/ArgumentResolver.php line 78 {"exception":"[object] (RuntimeException(code: 0): Controller \"Tests\\Fixtures\\ActionArgumentsBundle\\Controller\\NullableArgumentsController::withoutDefaultAction()\" requires that you provide a value for the \"$d\" argument. Either the argument is nullable and no null value has been provided, no default value has been provided or because there is a non optional argument after this one. at /Users/snebes/Sites/SensioFrameworkExtraBundle/vendor/symfony/http-kernel/Controller/ArgumentResolver.php:78)"} [] +[2019-07-19 15:06:51] request.CRITICAL: Uncaught PHP Exception RuntimeException: "Controller "Tests\Fixtures\ActionArgumentsBundle\Controller\NullableArgumentsController::withoutDefaultAction()" requires that you provide a value for the "$d" argument. Either the argument is nullable and no null value has been provided, no default value has been provided or because there is a non optional argument after this one." at /Users/snebes/Sites/SensioFrameworkExtraBundle/vendor/symfony/http-kernel/Controller/ArgumentResolver.php line 78 {"exception":"[object] (RuntimeException(code: 0): Controller \"Tests\\Fixtures\\ActionArgumentsBundle\\Controller\\NullableArgumentsController::withoutDefaultAction()\" requires that you provide a value for the \"$d\" argument. Either the argument is nullable and no null value has been provided, no default value has been provided or because there is a non optional argument after this one. at /Users/snebes/Sites/SensioFrameworkExtraBundle/vendor/symfony/http-kernel/Controller/ArgumentResolver.php:78)"} [] +[2019-07-19 15:08:48] request.CRITICAL: Uncaught PHP Exception RuntimeException: "Controller "Tests\Fixtures\ActionArgumentsBundle\Controller\NullableArgumentsController::withoutDefaultAction()" requires that you provide a value for the "$d" argument. Either the argument is nullable and no null value has been provided, no default value has been provided or because there is a non optional argument after this one." at /Users/snebes/Sites/SensioFrameworkExtraBundle/vendor/symfony/http-kernel/Controller/ArgumentResolver.php line 78 {"exception":"[object] (RuntimeException(code: 0): Controller \"Tests\\Fixtures\\ActionArgumentsBundle\\Controller\\NullableArgumentsController::withoutDefaultAction()\" requires that you provide a value for the \"$d\" argument. Either the argument is nullable and no null value has been provided, no default value has been provided or because there is a non optional argument after this one. at /Users/snebes/Sites/SensioFrameworkExtraBundle/vendor/symfony/http-kernel/Controller/ArgumentResolver.php:78)"} [] +[2019-07-19 15:09:20] request.CRITICAL: Uncaught PHP Exception RuntimeException: "Controller "Tests\Fixtures\ActionArgumentsBundle\Controller\NullableArgumentsController::withoutDefaultAction()" requires that you provide a value for the "$d" argument. Either the argument is nullable and no null value has been provided, no default value has been provided or because there is a non optional argument after this one." at /Users/snebes/Sites/SensioFrameworkExtraBundle/vendor/symfony/http-kernel/Controller/ArgumentResolver.php line 78 {"exception":"[object] (RuntimeException(code: 0): Controller \"Tests\\Fixtures\\ActionArgumentsBundle\\Controller\\NullableArgumentsController::withoutDefaultAction()\" requires that you provide a value for the \"$d\" argument. Either the argument is nullable and no null value has been provided, no default value has been provided or because there is a non optional argument after this one. at /Users/snebes/Sites/SensioFrameworkExtraBundle/vendor/symfony/http-kernel/Controller/ArgumentResolver.php:78)"} [] +[2019-07-19 15:09:44] request.CRITICAL: Uncaught PHP Exception RuntimeException: "Controller "Tests\Fixtures\ActionArgumentsBundle\Controller\NullableArgumentsController::withoutDefaultAction()" requires that you provide a value for the "$d" argument. Either the argument is nullable and no null value has been provided, no default value has been provided or because there is a non optional argument after this one." at /Users/snebes/Sites/SensioFrameworkExtraBundle/vendor/symfony/http-kernel/Controller/ArgumentResolver.php line 78 {"exception":"[object] (RuntimeException(code: 0): Controller \"Tests\\Fixtures\\ActionArgumentsBundle\\Controller\\NullableArgumentsController::withoutDefaultAction()\" requires that you provide a value for the \"$d\" argument. Either the argument is nullable and no null value has been provided, no default value has been provided or because there is a non optional argument after this one. at /Users/snebes/Sites/SensioFrameworkExtraBundle/vendor/symfony/http-kernel/Controller/ArgumentResolver.php:78)"} [] +[2019-07-19 15:11:36] request.CRITICAL: Uncaught PHP Exception RuntimeException: "Controller "Tests\Fixtures\ActionArgumentsBundle\Controller\NullableArgumentsController::withoutDefaultAction()" requires that you provide a value for the "$d" argument. Either the argument is nullable and no null value has been provided, no default value has been provided or because there is a non optional argument after this one." at /Users/snebes/Sites/SensioFrameworkExtraBundle/vendor/symfony/http-kernel/Controller/ArgumentResolver.php line 78 {"exception":"[object] (RuntimeException(code: 0): Controller \"Tests\\Fixtures\\ActionArgumentsBundle\\Controller\\NullableArgumentsController::withoutDefaultAction()\" requires that you provide a value for the \"$d\" argument. Either the argument is nullable and no null value has been provided, no default value has been provided or because there is a non optional argument after this one. at /Users/snebes/Sites/SensioFrameworkExtraBundle/vendor/symfony/http-kernel/Controller/ArgumentResolver.php:78)"} [] From 640851f9d2c4c18725b611e20b3dc7d6f38b4b38 Mon Sep 17 00:00:00 2001 From: Steve Nebes Date: Fri, 19 Jul 2019 10:13:22 -0500 Subject: [PATCH 2/7] [@IsGranted] Updated exception handling when the $subject is an array of values --- Tests/EventListener/IsGrantedListenerTest.php | 1 + 1 file changed, 1 insertion(+) diff --git a/Tests/EventListener/IsGrantedListenerTest.php b/Tests/EventListener/IsGrantedListenerTest.php index 21c77ac2..9a0fc274 100644 --- a/Tests/EventListener/IsGrantedListenerTest.php +++ b/Tests/EventListener/IsGrantedListenerTest.php @@ -148,6 +148,7 @@ public function getAccessDeniedMessageTests() yield [['ROLE_ADMIN'], null, 'Access Denied by controller annotation @IsGranted("ROLE_ADMIN")']; yield [['ROLE_ADMIN', 'ROLE_USER'], null, 'Access Denied by controller annotation @IsGranted(["ROLE_ADMIN", "ROLE_USER"])']; yield [['ROLE_ADMIN', 'ROLE_USER'], 'product', 'Access Denied by controller annotation @IsGranted(["ROLE_ADMIN", "ROLE_USER"], product)']; + yield [['ROLE_ADMIN', 'ROLE_USER'], ['product'], 'Access Denied by controller annotation @IsGranted(["ROLE_ADMIN", "ROLE_USER"], product)']; yield [['ROLE_ADMIN', 'ROLE_USER'], ['product', 'feature'], 'Access Denied by controller annotation @IsGranted(["ROLE_ADMIN", "ROLE_USER"], [product, feature])']; } From fc8ff8510aa095c1416a7af2da9c983e3058be7a Mon Sep 17 00:00:00 2001 From: Steve Nebes Date: Fri, 19 Jul 2019 10:13:46 -0500 Subject: [PATCH 3/7] [@IsGranted] Updated exception handling when the $subject is an array of values --- var/log/console.log | 13 ------------- 1 file changed, 13 deletions(-) delete mode 100644 var/log/console.log diff --git a/var/log/console.log b/var/log/console.log deleted file mode 100644 index 20a61943..00000000 --- a/var/log/console.log +++ /dev/null @@ -1,13 +0,0 @@ -[2019-07-19 14:56:24] request.CRITICAL: Uncaught PHP Exception RuntimeException: "Controller "Tests\Fixtures\ActionArgumentsBundle\Controller\NullableArgumentsController::withoutDefaultAction()" requires that you provide a value for the "$d" argument. Either the argument is nullable and no null value has been provided, no default value has been provided or because there is a non optional argument after this one." at /Users/snebes/Sites/SensioFrameworkExtraBundle/vendor/symfony/http-kernel/Controller/ArgumentResolver.php line 78 {"exception":"[object] (RuntimeException(code: 0): Controller \"Tests\\Fixtures\\ActionArgumentsBundle\\Controller\\NullableArgumentsController::withoutDefaultAction()\" requires that you provide a value for the \"$d\" argument. Either the argument is nullable and no null value has been provided, no default value has been provided or because there is a non optional argument after this one. at /Users/snebes/Sites/SensioFrameworkExtraBundle/vendor/symfony/http-kernel/Controller/ArgumentResolver.php:78)"} [] -[2019-07-19 14:59:10] request.CRITICAL: Uncaught PHP Exception RuntimeException: "Controller "Tests\Fixtures\ActionArgumentsBundle\Controller\NullableArgumentsController::withoutDefaultAction()" requires that you provide a value for the "$d" argument. Either the argument is nullable and no null value has been provided, no default value has been provided or because there is a non optional argument after this one." at /Users/snebes/Sites/SensioFrameworkExtraBundle/vendor/symfony/http-kernel/Controller/ArgumentResolver.php line 78 {"exception":"[object] (RuntimeException(code: 0): Controller \"Tests\\Fixtures\\ActionArgumentsBundle\\Controller\\NullableArgumentsController::withoutDefaultAction()\" requires that you provide a value for the \"$d\" argument. Either the argument is nullable and no null value has been provided, no default value has been provided or because there is a non optional argument after this one. at /Users/snebes/Sites/SensioFrameworkExtraBundle/vendor/symfony/http-kernel/Controller/ArgumentResolver.php:78)"} [] -[2019-07-19 15:00:55] request.CRITICAL: Uncaught PHP Exception RuntimeException: "Controller "Tests\Fixtures\ActionArgumentsBundle\Controller\NullableArgumentsController::withoutDefaultAction()" requires that you provide a value for the "$d" argument. Either the argument is nullable and no null value has been provided, no default value has been provided or because there is a non optional argument after this one." at /Users/snebes/Sites/SensioFrameworkExtraBundle/vendor/symfony/http-kernel/Controller/ArgumentResolver.php line 78 {"exception":"[object] (RuntimeException(code: 0): Controller \"Tests\\Fixtures\\ActionArgumentsBundle\\Controller\\NullableArgumentsController::withoutDefaultAction()\" requires that you provide a value for the \"$d\" argument. Either the argument is nullable and no null value has been provided, no default value has been provided or because there is a non optional argument after this one. at /Users/snebes/Sites/SensioFrameworkExtraBundle/vendor/symfony/http-kernel/Controller/ArgumentResolver.php:78)"} [] -[2019-07-19 15:01:02] request.CRITICAL: Uncaught PHP Exception RuntimeException: "Controller "Tests\Fixtures\ActionArgumentsBundle\Controller\NullableArgumentsController::withoutDefaultAction()" requires that you provide a value for the "$d" argument. Either the argument is nullable and no null value has been provided, no default value has been provided or because there is a non optional argument after this one." at /Users/snebes/Sites/SensioFrameworkExtraBundle/vendor/symfony/http-kernel/Controller/ArgumentResolver.php line 78 {"exception":"[object] (RuntimeException(code: 0): Controller \"Tests\\Fixtures\\ActionArgumentsBundle\\Controller\\NullableArgumentsController::withoutDefaultAction()\" requires that you provide a value for the \"$d\" argument. Either the argument is nullable and no null value has been provided, no default value has been provided or because there is a non optional argument after this one. at /Users/snebes/Sites/SensioFrameworkExtraBundle/vendor/symfony/http-kernel/Controller/ArgumentResolver.php:78)"} [] -[2019-07-19 15:02:08] request.CRITICAL: Uncaught PHP Exception RuntimeException: "Controller "Tests\Fixtures\ActionArgumentsBundle\Controller\NullableArgumentsController::withoutDefaultAction()" requires that you provide a value for the "$d" argument. Either the argument is nullable and no null value has been provided, no default value has been provided or because there is a non optional argument after this one." at /Users/snebes/Sites/SensioFrameworkExtraBundle/vendor/symfony/http-kernel/Controller/ArgumentResolver.php line 78 {"exception":"[object] (RuntimeException(code: 0): Controller \"Tests\\Fixtures\\ActionArgumentsBundle\\Controller\\NullableArgumentsController::withoutDefaultAction()\" requires that you provide a value for the \"$d\" argument. Either the argument is nullable and no null value has been provided, no default value has been provided or because there is a non optional argument after this one. at /Users/snebes/Sites/SensioFrameworkExtraBundle/vendor/symfony/http-kernel/Controller/ArgumentResolver.php:78)"} [] -[2019-07-19 15:02:33] request.CRITICAL: Uncaught PHP Exception RuntimeException: "Controller "Tests\Fixtures\ActionArgumentsBundle\Controller\NullableArgumentsController::withoutDefaultAction()" requires that you provide a value for the "$d" argument. Either the argument is nullable and no null value has been provided, no default value has been provided or because there is a non optional argument after this one." at /Users/snebes/Sites/SensioFrameworkExtraBundle/vendor/symfony/http-kernel/Controller/ArgumentResolver.php line 78 {"exception":"[object] (RuntimeException(code: 0): Controller \"Tests\\Fixtures\\ActionArgumentsBundle\\Controller\\NullableArgumentsController::withoutDefaultAction()\" requires that you provide a value for the \"$d\" argument. Either the argument is nullable and no null value has been provided, no default value has been provided or because there is a non optional argument after this one. at /Users/snebes/Sites/SensioFrameworkExtraBundle/vendor/symfony/http-kernel/Controller/ArgumentResolver.php:78)"} [] -[2019-07-19 15:04:16] request.CRITICAL: Uncaught PHP Exception RuntimeException: "Controller "Tests\Fixtures\ActionArgumentsBundle\Controller\NullableArgumentsController::withoutDefaultAction()" requires that you provide a value for the "$d" argument. Either the argument is nullable and no null value has been provided, no default value has been provided or because there is a non optional argument after this one." at /Users/snebes/Sites/SensioFrameworkExtraBundle/vendor/symfony/http-kernel/Controller/ArgumentResolver.php line 78 {"exception":"[object] (RuntimeException(code: 0): Controller \"Tests\\Fixtures\\ActionArgumentsBundle\\Controller\\NullableArgumentsController::withoutDefaultAction()\" requires that you provide a value for the \"$d\" argument. Either the argument is nullable and no null value has been provided, no default value has been provided or because there is a non optional argument after this one. at /Users/snebes/Sites/SensioFrameworkExtraBundle/vendor/symfony/http-kernel/Controller/ArgumentResolver.php:78)"} [] -[2019-07-19 15:06:14] request.CRITICAL: Uncaught PHP Exception RuntimeException: "Controller "Tests\Fixtures\ActionArgumentsBundle\Controller\NullableArgumentsController::withoutDefaultAction()" requires that you provide a value for the "$d" argument. Either the argument is nullable and no null value has been provided, no default value has been provided or because there is a non optional argument after this one." at /Users/snebes/Sites/SensioFrameworkExtraBundle/vendor/symfony/http-kernel/Controller/ArgumentResolver.php line 78 {"exception":"[object] (RuntimeException(code: 0): Controller \"Tests\\Fixtures\\ActionArgumentsBundle\\Controller\\NullableArgumentsController::withoutDefaultAction()\" requires that you provide a value for the \"$d\" argument. Either the argument is nullable and no null value has been provided, no default value has been provided or because there is a non optional argument after this one. at /Users/snebes/Sites/SensioFrameworkExtraBundle/vendor/symfony/http-kernel/Controller/ArgumentResolver.php:78)"} [] -[2019-07-19 15:06:51] request.CRITICAL: Uncaught PHP Exception RuntimeException: "Controller "Tests\Fixtures\ActionArgumentsBundle\Controller\NullableArgumentsController::withoutDefaultAction()" requires that you provide a value for the "$d" argument. Either the argument is nullable and no null value has been provided, no default value has been provided or because there is a non optional argument after this one." at /Users/snebes/Sites/SensioFrameworkExtraBundle/vendor/symfony/http-kernel/Controller/ArgumentResolver.php line 78 {"exception":"[object] (RuntimeException(code: 0): Controller \"Tests\\Fixtures\\ActionArgumentsBundle\\Controller\\NullableArgumentsController::withoutDefaultAction()\" requires that you provide a value for the \"$d\" argument. Either the argument is nullable and no null value has been provided, no default value has been provided or because there is a non optional argument after this one. at /Users/snebes/Sites/SensioFrameworkExtraBundle/vendor/symfony/http-kernel/Controller/ArgumentResolver.php:78)"} [] -[2019-07-19 15:08:48] request.CRITICAL: Uncaught PHP Exception RuntimeException: "Controller "Tests\Fixtures\ActionArgumentsBundle\Controller\NullableArgumentsController::withoutDefaultAction()" requires that you provide a value for the "$d" argument. Either the argument is nullable and no null value has been provided, no default value has been provided or because there is a non optional argument after this one." at /Users/snebes/Sites/SensioFrameworkExtraBundle/vendor/symfony/http-kernel/Controller/ArgumentResolver.php line 78 {"exception":"[object] (RuntimeException(code: 0): Controller \"Tests\\Fixtures\\ActionArgumentsBundle\\Controller\\NullableArgumentsController::withoutDefaultAction()\" requires that you provide a value for the \"$d\" argument. Either the argument is nullable and no null value has been provided, no default value has been provided or because there is a non optional argument after this one. at /Users/snebes/Sites/SensioFrameworkExtraBundle/vendor/symfony/http-kernel/Controller/ArgumentResolver.php:78)"} [] -[2019-07-19 15:09:20] request.CRITICAL: Uncaught PHP Exception RuntimeException: "Controller "Tests\Fixtures\ActionArgumentsBundle\Controller\NullableArgumentsController::withoutDefaultAction()" requires that you provide a value for the "$d" argument. Either the argument is nullable and no null value has been provided, no default value has been provided or because there is a non optional argument after this one." at /Users/snebes/Sites/SensioFrameworkExtraBundle/vendor/symfony/http-kernel/Controller/ArgumentResolver.php line 78 {"exception":"[object] (RuntimeException(code: 0): Controller \"Tests\\Fixtures\\ActionArgumentsBundle\\Controller\\NullableArgumentsController::withoutDefaultAction()\" requires that you provide a value for the \"$d\" argument. Either the argument is nullable and no null value has been provided, no default value has been provided or because there is a non optional argument after this one. at /Users/snebes/Sites/SensioFrameworkExtraBundle/vendor/symfony/http-kernel/Controller/ArgumentResolver.php:78)"} [] -[2019-07-19 15:09:44] request.CRITICAL: Uncaught PHP Exception RuntimeException: "Controller "Tests\Fixtures\ActionArgumentsBundle\Controller\NullableArgumentsController::withoutDefaultAction()" requires that you provide a value for the "$d" argument. Either the argument is nullable and no null value has been provided, no default value has been provided or because there is a non optional argument after this one." at /Users/snebes/Sites/SensioFrameworkExtraBundle/vendor/symfony/http-kernel/Controller/ArgumentResolver.php line 78 {"exception":"[object] (RuntimeException(code: 0): Controller \"Tests\\Fixtures\\ActionArgumentsBundle\\Controller\\NullableArgumentsController::withoutDefaultAction()\" requires that you provide a value for the \"$d\" argument. Either the argument is nullable and no null value has been provided, no default value has been provided or because there is a non optional argument after this one. at /Users/snebes/Sites/SensioFrameworkExtraBundle/vendor/symfony/http-kernel/Controller/ArgumentResolver.php:78)"} [] -[2019-07-19 15:11:36] request.CRITICAL: Uncaught PHP Exception RuntimeException: "Controller "Tests\Fixtures\ActionArgumentsBundle\Controller\NullableArgumentsController::withoutDefaultAction()" requires that you provide a value for the "$d" argument. Either the argument is nullable and no null value has been provided, no default value has been provided or because there is a non optional argument after this one." at /Users/snebes/Sites/SensioFrameworkExtraBundle/vendor/symfony/http-kernel/Controller/ArgumentResolver.php line 78 {"exception":"[object] (RuntimeException(code: 0): Controller \"Tests\\Fixtures\\ActionArgumentsBundle\\Controller\\NullableArgumentsController::withoutDefaultAction()\" requires that you provide a value for the \"$d\" argument. Either the argument is nullable and no null value has been provided, no default value has been provided or because there is a non optional argument after this one. at /Users/snebes/Sites/SensioFrameworkExtraBundle/vendor/symfony/http-kernel/Controller/ArgumentResolver.php:78)"} [] From b26308077babbe18875243a90ab9851240a58709 Mon Sep 17 00:00:00 2001 From: Steve Nebes Date: Fri, 19 Jul 2019 10:17:09 -0500 Subject: [PATCH 4/7] Applied code standards recommendation --- EventListener/IsGrantedListener.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/EventListener/IsGrantedListener.php b/EventListener/IsGrantedListener.php index 4d72a7a1..925b7459 100644 --- a/EventListener/IsGrantedListener.php +++ b/EventListener/IsGrantedListener.php @@ -105,14 +105,14 @@ private function getIsGrantedString(IsGranted $isGranted) } if (null !== $isGranted->getSubject()) { - $subjects = \array_map(function ($subject) { - return \sprintf('%s', $subject); + $subjects = array_map(function ($subject) { + return sprintf('%s', $subject); }, (array) $isGranted->getSubject()); if (1 === \count($subjects)) { - $subjectString = \reset($subjects); + $subjectString = reset($subjects); } else { - $subjectString = \sprintf('[%s]', \implode(', ', $subjects)); + $subjectString = sprintf('[%s]', \implode(', ', $subjects)); } $argsString = sprintf('%s, %s', $argsString, $subjectString); From ceb187b80d334117887abbc7b64bfe8bdd362748 Mon Sep 17 00:00:00 2001 From: Steve Nebes Date: Fri, 19 Jul 2019 10:17:46 -0500 Subject: [PATCH 5/7] Applied code standards recommendation --- EventListener/IsGrantedListener.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/EventListener/IsGrantedListener.php b/EventListener/IsGrantedListener.php index 925b7459..399269b8 100644 --- a/EventListener/IsGrantedListener.php +++ b/EventListener/IsGrantedListener.php @@ -112,7 +112,7 @@ private function getIsGrantedString(IsGranted $isGranted) if (1 === \count($subjects)) { $subjectString = reset($subjects); } else { - $subjectString = sprintf('[%s]', \implode(', ', $subjects)); + $subjectString = sprintf('[%s]', implode(', ', $subjects)); } $argsString = sprintf('%s, %s', $argsString, $subjectString); From 899449451c026f45d857a322a35e3a878df1408f Mon Sep 17 00:00:00 2001 From: Steve Nebes Date: Fri, 19 Jul 2019 10:22:28 -0500 Subject: [PATCH 6/7] Remixed variable assignment --- EventListener/IsGrantedListener.php | 6 ++---- var/log/console.log | 1 + 2 files changed, 3 insertions(+), 4 deletions(-) create mode 100644 var/log/console.log diff --git a/EventListener/IsGrantedListener.php b/EventListener/IsGrantedListener.php index 399269b8..7cb8c461 100644 --- a/EventListener/IsGrantedListener.php +++ b/EventListener/IsGrantedListener.php @@ -110,12 +110,10 @@ private function getIsGrantedString(IsGranted $isGranted) }, (array) $isGranted->getSubject()); if (1 === \count($subjects)) { - $subjectString = reset($subjects); + $argsString = sprintf('%s, %s', $argsString, reset($subjects)); } else { - $subjectString = sprintf('[%s]', implode(', ', $subjects)); + $argsString = sprintf('%s, [%s]', $argsString, implode(', ', $subjects)); } - - $argsString = sprintf('%s, %s', $argsString, $subjectString); } return $argsString; diff --git a/var/log/console.log b/var/log/console.log new file mode 100644 index 00000000..17c88d2e --- /dev/null +++ b/var/log/console.log @@ -0,0 +1 @@ +[2019-07-19 15:22:03] request.CRITICAL: Uncaught PHP Exception RuntimeException: "Controller "Tests\Fixtures\ActionArgumentsBundle\Controller\NullableArgumentsController::withoutDefaultAction()" requires that you provide a value for the "$d" argument. Either the argument is nullable and no null value has been provided, no default value has been provided or because there is a non optional argument after this one." at /Users/snebes/Sites/SensioFrameworkExtraBundle/vendor/symfony/http-kernel/Controller/ArgumentResolver.php line 78 {"exception":"[object] (RuntimeException(code: 0): Controller \"Tests\\Fixtures\\ActionArgumentsBundle\\Controller\\NullableArgumentsController::withoutDefaultAction()\" requires that you provide a value for the \"$d\" argument. Either the argument is nullable and no null value has been provided, no default value has been provided or because there is a non optional argument after this one. at /Users/snebes/Sites/SensioFrameworkExtraBundle/vendor/symfony/http-kernel/Controller/ArgumentResolver.php:78)"} [] From 10feda14b37bf46632b2b89928ada6ac77f878e4 Mon Sep 17 00:00:00 2001 From: Steve Nebes Date: Fri, 19 Jul 2019 10:28:43 -0500 Subject: [PATCH 7/7] Removed log file --- var/log/console.log | 1 - 1 file changed, 1 deletion(-) delete mode 100644 var/log/console.log diff --git a/var/log/console.log b/var/log/console.log deleted file mode 100644 index 17c88d2e..00000000 --- a/var/log/console.log +++ /dev/null @@ -1 +0,0 @@ -[2019-07-19 15:22:03] request.CRITICAL: Uncaught PHP Exception RuntimeException: "Controller "Tests\Fixtures\ActionArgumentsBundle\Controller\NullableArgumentsController::withoutDefaultAction()" requires that you provide a value for the "$d" argument. Either the argument is nullable and no null value has been provided, no default value has been provided or because there is a non optional argument after this one." at /Users/snebes/Sites/SensioFrameworkExtraBundle/vendor/symfony/http-kernel/Controller/ArgumentResolver.php line 78 {"exception":"[object] (RuntimeException(code: 0): Controller \"Tests\\Fixtures\\ActionArgumentsBundle\\Controller\\NullableArgumentsController::withoutDefaultAction()\" requires that you provide a value for the \"$d\" argument. Either the argument is nullable and no null value has been provided, no default value has been provided or because there is a non optional argument after this one. at /Users/snebes/Sites/SensioFrameworkExtraBundle/vendor/symfony/http-kernel/Controller/ArgumentResolver.php:78)"} []