{"action":"created","comment":{"url":"https://api.github.com/repos/symfony/symfony/pulls/comments/147211333","pull_request_review_id":72275656,"id":147211333,"diff_hunk":"@@ -21,13 +24,43 @@\n  */\n class SecurityExtension extends AbstractExtension\n {\n+    private $securityChecker;\n+\n+    public function __construct(AuthorizationCheckerInterface $securityChecker = null)\n+    {\n+        if (null !== $securityChecker) {\n+            @trigger_error(sprintf('The $securityChecker parameter is deprecated since 3.4 and will be removed in 4.0. Use %s instead.', SecurityRuntime::class), E_USER_DEPRECATED);","path":"src/Symfony/Bridge/Twig/Extension/SecurityExtension.php","position":null,"original_position":19,"commit_id":"592bb6af2152d444cda44a3c86aea3b68de9eb15","original_commit_id":"592bb6af2152d444cda44a3c86aea3b68de9eb15","user":{"login":"chalasr","id":7502063,"avatar_url":"https://avatars0.githubusercontent.com/u/7502063?v=4","gravatar_id":"","url":"https://api.github.com/users/chalasr","html_url":"https://github.com/chalasr","followers_url":"https://api.github.com/users/chalasr/followers","following_url":"https://api.github.com/users/chalasr/following{/other_user}","gists_url":"https://api.github.com/users/chalasr/gists{/gist_id}","starred_url":"https://api.github.com/users/chalasr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chalasr/subscriptions","organizations_url":"https://api.github.com/users/chalasr/orgs","repos_url":"https://api.github.com/users/chalasr/repos","events_url":"https://api.github.com/users/chalasr/events{/privacy}","received_events_url":"https://api.github.com/users/chalasr/received_events","type":"User","site_admin":false},"body":"Except for the constructor arg in fact, this one is not about inheritance but direct instantiation. It should be kept","created_at":"2017-10-26T17:24:55Z","updated_at":"2017-10-26T17:24:55Z","html_url":"https://github.com/symfony/symfony/pull/24692#discussion_r147211333","pull_request_url":"https://api.github.com/repos/symfony/symfony/pulls/24692","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/symfony/symfony/pulls/comments/147211333"},"html":{"href":"https://github.com/symfony/symfony/pull/24692#discussion_r147211333"},"pull_request":{"href":"https://api.github.com/repos/symfony/symfony/pulls/24692"}},"in_reply_to_id":147210869},"pull_request":{"url":"https://api.github.com/repos/symfony/symfony/pulls/24692","id":148732689,"html_url":"https://github.com/symfony/symfony/pull/24692","diff_url":"https://github.com/symfony/symfony/pull/24692.diff","patch_url":"https://github.com/symfony/symfony/pull/24692.patch","issue_url":"https://api.github.com/repos/symfony/symfony/issues/24692","number":24692,"state":"open","locked":false,"title":"[Bridge][Twig] Decouple the SecurityExtension from its runtime","user":{"login":"CarsonF","id":932566,"avatar_url":"https://avatars3.githubusercontent.com/u/932566?v=4","gravatar_id":"","url":"https://api.github.com/users/CarsonF","html_url":"https://github.com/CarsonF","followers_url":"https://api.github.com/users/CarsonF/followers","following_url":"https://api.github.com/users/CarsonF/following{/other_user}","gists_url":"https://api.github.com/users/CarsonF/gists{/gist_id}","starred_url":"https://api.github.com/users/CarsonF/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CarsonF/subscriptions","organizations_url":"https://api.github.com/users/CarsonF/orgs","repos_url":"https://api.github.com/users/CarsonF/repos","events_url":"https://api.github.com/users/CarsonF/events{/privacy}","received_events_url":"https://api.github.com/users/CarsonF/received_events","type":"User","site_admin":false},"body":"| Q             | A\r\n| ------------- | ---\r\n| Branch?       | 3.4\r\n| Bug fix?      | yes\r\n| New feature?  | no\r\n| BC breaks?    | no\r\n| Deprecations? | no\r\n| Tests pass?   | yes\r\n| Fixed tickets | N/A\r\n| License       | MIT\r\n| Doc PR        | N/A\r\n\r\nThis indirectly fixes two bugs in Silex regarding Security and Twig.\r\n\r\nThe first is if `twig` is loaded before `boot()` some services/parameters are not defined.\r\n- `twig` asks for `security.authorization_checker`\r\n- `security.authorization_checker` asks for `security.authentication_manager`\r\n- `security.authentication_manager` asks for `security.authentication_providers`\r\n- `security.authentication_providers` are not completely defined until `security.firewall_map` is loaded ([here](https://github.com/silexphp/Silex/blob/master/src/Silex/Provider/SecurityServiceProvider.php#L307)).\r\n\r\nI fixed this locally by wrapping the `security.authorization_checker` service and loading the `security.firewall_map` before hand:\r\n\r\n```php\r\n// Load firewall map before this, because it defines a dependency needed.\r\n$factory = $app->raw('security.authorization_checker');\r\n$app['security.authorization_checker'] = function ($app) use ($factory) {\r\n    $app['security.firewall_map'];\r\n\r\n    return $factory($app);\r\n};\r\n```\r\n\r\nThis technically fixed the problem, but it wouldn't be needed if the service wasn't loaded until `boot()` where the firewall is loaded by default.\r\n\r\n-----\r\n\r\nThe second problem is a circular dependency. I was implementing an AccessDeniedHandler that rendered a template.\r\n- `security.firewall_map` asks for AccessDeniedHandler service\r\n- AccessDeniedHandler service asks for `twig`\r\n- `twig` asks for `security.firewall_map` ....:boom:\r\n\r\nAnd again this wouldn't be a problem if `twig` didn't need the `SecurityRuntime` until it's `is_granted` is called. \r\n\r\n-----\r\n\r\nI don't see this as a _feature_ since it only modifies private services. And I _do_ see this as a _bugfix_ even though it's for Silex and not Symfony. But I know it's a gray area. Twig Runtimes seem to be the way we are heading so I don't think this is a step in the wrong direction either.\r\n\r\nI have a PR ready for Silex depending on the direction of this issue. Here's the [diff](https://github.com/silexphp/Silex/compare/master...CarsonF:bugfix/security-runtime).","created_at":"2017-10-25T17:31:26Z","updated_at":"2017-10-26T17:24:55Z","closed_at":null,"merged_at":null,"merge_commit_sha":"339a3c933e959d2bdba365b09dd26ddcc351172a","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":{"url":"https://api.github.com/repos/symfony/symfony/milestones/17","html_url":"https://github.com/symfony/symfony/milestone/17","labels_url":"https://api.github.com/repos/symfony/symfony/milestones/17/labels","id":2795131,"number":17,"title":"4.1","description":"https://symfony.com/roadmap?version=4.1#checker","creator":{"login":"nicolas-grekas","id":243674,"avatar_url":"https://avatars3.githubusercontent.com/u/243674?v=4","gravatar_id":"","url":"https://api.github.com/users/nicolas-grekas","html_url":"https://github.com/nicolas-grekas","followers_url":"https://api.github.com/users/nicolas-grekas/followers","following_url":"https://api.github.com/users/nicolas-grekas/following{/other_user}","gists_url":"https://api.github.com/users/nicolas-grekas/gists{/gist_id}","starred_url":"https://api.github.com/users/nicolas-grekas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nicolas-grekas/subscriptions","organizations_url":"https://api.github.com/users/nicolas-grekas/orgs","repos_url":"https://api.github.com/users/nicolas-grekas/repos","events_url":"https://api.github.com/users/nicolas-grekas/events{/privacy}","received_events_url":"https://api.github.com/users/nicolas-grekas/received_events","type":"User","site_admin":false},"open_issues":94,"closed_issues":11,"state":"open","created_at":"2017-09-26T15:40:00Z","updated_at":"2017-10-26T10:07:59Z","due_on":"2018-05-31T07:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/symfony/symfony/pulls/24692/commits","review_comments_url":"https://api.github.com/repos/symfony/symfony/pulls/24692/comments","review_comment_url":"https://api.github.com/repos/symfony/symfony/pulls/comments{/number}","comments_url":"https://api.github.com/repos/symfony/symfony/issues/24692/comments","statuses_url":"https://api.github.com/repos/symfony/symfony/statuses/592bb6af2152d444cda44a3c86aea3b68de9eb15","head":{"label":"CarsonF:bugfix/twig-security-runtime","ref":"bugfix/twig-security-runtime","sha":"592bb6af2152d444cda44a3c86aea3b68de9eb15","user":{"login":"CarsonF","id":932566,"avatar_url":"https://avatars3.githubusercontent.com/u/932566?v=4","gravatar_id":"","url":"https://api.github.com/users/CarsonF","html_url":"https://github.com/CarsonF","followers_url":"https://api.github.com/users/CarsonF/followers","following_url":"https://api.github.com/users/CarsonF/following{/other_user}","gists_url":"https://api.github.com/users/CarsonF/gists{/gist_id}","starred_url":"https://api.github.com/users/CarsonF/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CarsonF/subscriptions","organizations_url":"https://api.github.com/users/CarsonF/orgs","repos_url":"https://api.github.com/users/CarsonF/repos","events_url":"https://api.github.com/users/CarsonF/events{/privacy}","received_events_url":"https://api.github.com/users/CarsonF/received_events","type":"User","site_admin":false},"repo":{"id":45508493,"name":"symfony","full_name":"CarsonF/symfony","owner":{"login":"CarsonF","id":932566,"avatar_url":"https://avatars3.githubusercontent.com/u/932566?v=4","gravatar_id":"","url":"https://api.github.com/users/CarsonF","html_url":"https://github.com/CarsonF","followers_url":"https://api.github.com/users/CarsonF/followers","following_url":"https://api.github.com/users/CarsonF/following{/other_user}","gists_url":"https://api.github.com/users/CarsonF/gists{/gist_id}","starred_url":"https://api.github.com/users/CarsonF/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CarsonF/subscriptions","organizations_url":"https://api.github.com/users/CarsonF/orgs","repos_url":"https://api.github.com/users/CarsonF/repos","events_url":"https://api.github.com/users/CarsonF/events{/privacy}","received_events_url":"https://api.github.com/users/CarsonF/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/CarsonF/symfony","description":"The Symfony PHP framework","fork":true,"url":"https://api.github.com/repos/CarsonF/symfony","forks_url":"https://api.github.com/repos/CarsonF/symfony/forks","keys_url":"https://api.github.com/repos/CarsonF/symfony/keys{/key_id}","collaborators_url":"https://api.github.com/repos/CarsonF/symfony/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/CarsonF/symfony/teams","hooks_url":"https://api.github.com/repos/CarsonF/symfony/hooks","issue_events_url":"https://api.github.com/repos/CarsonF/symfony/issues/events{/number}","events_url":"https://api.github.com/repos/CarsonF/symfony/events","assignees_url":"https://api.github.com/repos/CarsonF/symfony/assignees{/user}","branches_url":"https://api.github.com/repos/CarsonF/symfony/branches{/branch}","tags_url":"https://api.github.com/repos/CarsonF/symfony/tags","blobs_url":"https://api.github.com/repos/CarsonF/symfony/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/CarsonF/symfony/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/CarsonF/symfony/git/refs{/sha}","trees_url":"https://api.github.com/repos/CarsonF/symfony/git/trees{/sha}","statuses_url":"https://api.github.com/repos/CarsonF/symfony/statuses/{sha}","languages_url":"https://api.github.com/repos/CarsonF/symfony/languages","stargazers_url":"https://api.github.com/repos/CarsonF/symfony/stargazers","contributors_url":"https://api.github.com/repos/CarsonF/symfony/contributors","subscribers_url":"https://api.github.com/repos/CarsonF/symfony/subscribers","subscription_url":"https://api.github.com/repos/CarsonF/symfony/subscription","commits_url":"https://api.github.com/repos/CarsonF/symfony/commits{/sha}","git_commits_url":"https://api.github.com/repos/CarsonF/symfony/git/commits{/sha}","comments_url":"https://api.github.com/repos/CarsonF/symfony/comments{/number}","issue_comment_url":"https://api.github.com/repos/CarsonF/symfony/issues/comments{/number}","contents_url":"https://api.github.com/repos/CarsonF/symfony/contents/{+path}","compare_url":"https://api.github.com/repos/CarsonF/symfony/compare/{base}...{head}","merges_url":"https://api.github.com/repos/CarsonF/symfony/merges","archive_url":"https://api.github.com/repos/CarsonF/symfony/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/CarsonF/symfony/downloads","issues_url":"https://api.github.com/repos/CarsonF/symfony/issues{/number}","pulls_url":"https://api.github.com/repos/CarsonF/symfony/pulls{/number}","milestones_url":"https://api.github.com/repos/CarsonF/symfony/milestones{/number}","notifications_url":"https://api.github.com/repos/CarsonF/symfony/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/CarsonF/symfony/labels{/name}","releases_url":"https://api.github.com/repos/CarsonF/symfony/releases{/id}","deployments_url":"https://api.github.com/repos/CarsonF/symfony/deployments","created_at":"2015-11-04T01:59:01Z","updated_at":"2015-11-04T01:59:19Z","pushed_at":"2017-10-26T17:17:30Z","git_url":"git://github.com/CarsonF/symfony.git","ssh_url":"git@github.com:CarsonF/symfony.git","clone_url":"https://github.com/CarsonF/symfony.git","svn_url":"https://github.com/CarsonF/symfony","homepage":"symfony.com","size":99516,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":false,"has_projects":true,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"2.8"}},"base":{"label":"symfony:3.4","ref":"3.4","sha":"78426b79d2a66c2785bce66ed18bf869b3800ec4","user":{"login":"symfony","id":143937,"avatar_url":"https://avatars3.githubusercontent.com/u/143937?v=4","gravatar_id":"","url":"https://api.github.com/users/symfony","html_url":"https://github.com/symfony","followers_url":"https://api.github.com/users/symfony/followers","following_url":"https://api.github.com/users/symfony/following{/other_user}","gists_url":"https://api.github.com/users/symfony/gists{/gist_id}","starred_url":"https://api.github.com/users/symfony/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/symfony/subscriptions","organizations_url":"https://api.github.com/users/symfony/orgs","repos_url":"https://api.github.com/users/symfony/repos","events_url":"https://api.github.com/users/symfony/events{/privacy}","received_events_url":"https://api.github.com/users/symfony/received_events","type":"Organization","site_admin":false},"repo":{"id":458058,"name":"symfony","full_name":"symfony/symfony","owner":{"login":"symfony","id":143937,"avatar_url":"https://avatars3.githubusercontent.com/u/143937?v=4","gravatar_id":"","url":"https://api.github.com/users/symfony","html_url":"https://github.com/symfony","followers_url":"https://api.github.com/users/symfony/followers","following_url":"https://api.github.com/users/symfony/following{/other_user}","gists_url":"https://api.github.com/users/symfony/gists{/gist_id}","starred_url":"https://api.github.com/users/symfony/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/symfony/subscriptions","organizations_url":"https://api.github.com/users/symfony/orgs","repos_url":"https://api.github.com/users/symfony/repos","events_url":"https://api.github.com/users/symfony/events{/privacy}","received_events_url":"https://api.github.com/users/symfony/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/symfony/symfony","description":"The Symfony PHP framework","fork":false,"url":"https://api.github.com/repos/symfony/symfony","forks_url":"https://api.github.com/repos/symfony/symfony/forks","keys_url":"https://api.github.com/repos/symfony/symfony/keys{/key_id}","collaborators_url":"https://api.github.com/repos/symfony/symfony/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/symfony/symfony/teams","hooks_url":"https://api.github.com/repos/symfony/symfony/hooks","issue_events_url":"https://api.github.com/repos/symfony/symfony/issues/events{/number}","events_url":"https://api.github.com/repos/symfony/symfony/events","assignees_url":"https://api.github.com/repos/symfony/symfony/assignees{/user}","branches_url":"https://api.github.com/repos/symfony/symfony/branches{/branch}","tags_url":"https://api.github.com/repos/symfony/symfony/tags","blobs_url":"https://api.github.com/repos/symfony/symfony/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/symfony/symfony/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/symfony/symfony/git/refs{/sha}","trees_url":"https://api.github.com/repos/symfony/symfony/git/trees{/sha}","statuses_url":"https://api.github.com/repos/symfony/symfony/statuses/{sha}","languages_url":"https://api.github.com/repos/symfony/symfony/languages","stargazers_url":"https://api.github.com/repos/symfony/symfony/stargazers","contributors_url":"https://api.github.com/repos/symfony/symfony/contributors","subscribers_url":"https://api.github.com/repos/symfony/symfony/subscribers","subscription_url":"https://api.github.com/repos/symfony/symfony/subscription","commits_url":"https://api.github.com/repos/symfony/symfony/commits{/sha}","git_commits_url":"https://api.github.com/repos/symfony/symfony/git/commits{/sha}","comments_url":"https://api.github.com/repos/symfony/symfony/comments{/number}","issue_comment_url":"https://api.github.com/repos/symfony/symfony/issues/comments{/number}","contents_url":"https://api.github.com/repos/symfony/symfony/contents/{+path}","compare_url":"https://api.github.com/repos/symfony/symfony/compare/{base}...{head}","merges_url":"https://api.github.com/repos/symfony/symfony/merges","archive_url":"https://api.github.com/repos/symfony/symfony/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/symfony/symfony/downloads","issues_url":"https://api.github.com/repos/symfony/symfony/issues{/number}","pulls_url":"https://api.github.com/repos/symfony/symfony/pulls{/number}","milestones_url":"https://api.github.com/repos/symfony/symfony/milestones{/number}","notifications_url":"https://api.github.com/repos/symfony/symfony/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/symfony/symfony/labels{/name}","releases_url":"https://api.github.com/repos/symfony/symfony/releases{/id}","deployments_url":"https://api.github.com/repos/symfony/symfony/deployments","created_at":"2010-01-04T14:21:21Z","updated_at":"2017-10-26T15:05:39Z","pushed_at":"2017-10-26T17:17:36Z","git_url":"git://github.com/symfony/symfony.git","ssh_url":"git@github.com:symfony/symfony.git","clone_url":"https://github.com/symfony/symfony.git","svn_url":"https://github.com/symfony/symfony","homepage":"symfony.com","size":105586,"stargazers_count":15441,"watchers_count":15441,"language":"PHP","has_issues":true,"has_projects":true,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":5772,"mirror_url":null,"archived":false,"open_issues_count":790,"forks":5772,"open_issues":790,"watchers":15441,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/symfony/symfony/pulls/24692"},"html":{"href":"https://github.com/symfony/symfony/pull/24692"},"issue":{"href":"https://api.github.com/repos/symfony/symfony/issues/24692"},"comments":{"href":"https://api.github.com/repos/symfony/symfony/issues/24692/comments"},"review_comments":{"href":"https://api.github.com/repos/symfony/symfony/pulls/24692/comments"},"review_comment":{"href":"https://api.github.com/repos/symfony/symfony/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/symfony/symfony/pulls/24692/commits"},"statuses":{"href":"https://api.github.com/repos/symfony/symfony/statuses/592bb6af2152d444cda44a3c86aea3b68de9eb15"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"chalasr"}}