{"action":"created","comment":{"url":"https://api.github.com/repos/contao/core-bundle/pulls/comments/87135141","pull_request_review_id":7758675,"id":87135141,"diff_hunk":"@@ -0,0 +1,97 @@\n+<?php\n+\n+/*\n+ * This file is part of Contao.\n+ *\n+ * Copyright (c) 2005-2016 Leo Feyer\n+ *\n+ * @license LGPL-3.0+\n+ */\n+\n+namespace Contao\\CoreBundle\\EventListener;\n+\n+use Contao\\CoreBundle\\Request\\ValueAdapter;\n+use Contao\\Environment;\n+use Contao\\Input;\n+use Symfony\\Component\\EventDispatcher\\EventSubscriberInterface;\n+use Symfony\\Component\\HttpFoundation\\Request;\n+use Symfony\\Component\\HttpFoundation\\RequestStack;\n+use Symfony\\Component\\HttpKernel\\KernelEvents;\n+\n+/**\n+ * Sets the current request on the \\Input and \\Environment classes.\n+ *\n+ * @author Christian Schiffler <https://github.com/discordier>\n+ *\n+ * @deprecated Deprecated since Contao 4.3, to be removed in Contao 5.0.\n+ *             Use the request or request stack instead.\n+ */\n+class LegacyRequestValueSynchronizingListener implements EventSubscriberInterface\n+{\n+    /**\n+     * @var RequestStack\n+     */\n+    private $requestStack;\n+\n+    /**\n+     * Constructor.\n+     *\n+     * @param RequestStack $requestStack\n+     */\n+    public function __construct(RequestStack $requestStack)\n+    {\n+        $this->requestStack = $requestStack;\n+    }\n+\n+    /**\n+     * {@inheritDoc}\n+     */\n+    public static function getSubscribedEvents()\n+    {\n+        return [\n+            KernelEvents::REQUEST => array('startRequest', 10),\n+            KernelEvents::FINISH_REQUEST => array('finishRequest', -10)\n+        ];\n+    }\n+\n+    /**\n+     * Store the request in the Contao 3 classes.\n+     *\n+     * @return void\n+     */\n+    public function startRequest()","path":"src/EventListener/LegacyRequestValueSynchronizingListener.php","position":53,"original_position":62,"commit_id":"d96a654cf34f1768242c20f822d41b313b9e08b5","original_commit_id":"b8ec8bfd6d78b4b8239b149629dd9b59f1a2ed5f","user":{"login":"discordier","id":940331,"avatar_url":"https://avatars.githubusercontent.com/u/940331?v=3","gravatar_id":"","url":"https://api.github.com/users/discordier","html_url":"https://github.com/discordier","followers_url":"https://api.github.com/users/discordier/followers","following_url":"https://api.github.com/users/discordier/following{/other_user}","gists_url":"https://api.github.com/users/discordier/gists{/gist_id}","starred_url":"https://api.github.com/users/discordier/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/discordier/subscriptions","organizations_url":"https://api.github.com/users/discordier/orgs","repos_url":"https://api.github.com/users/discordier/repos","events_url":"https://api.github.com/users/discordier/events{/privacy}","received_events_url":"https://api.github.com/users/discordier/received_events","type":"User","site_admin":false},"body":"Implemented in 2c27fb1","created_at":"2016-11-09T05:34:11Z","updated_at":"2016-11-09T05:34:11Z","html_url":"https://github.com/contao/core-bundle/pull/575#discussion_r87135141","pull_request_url":"https://api.github.com/repos/contao/core-bundle/pulls/575","_links":{"self":{"href":"https://api.github.com/repos/contao/core-bundle/pulls/comments/87135141"},"html":{"href":"https://github.com/contao/core-bundle/pull/575#discussion_r87135141"},"pull_request":{"href":"https://api.github.com/repos/contao/core-bundle/pulls/575"}}},"pull_request":{"url":"https://api.github.com/repos/contao/core-bundle/pulls/575","id":83195811,"html_url":"https://github.com/contao/core-bundle/pull/575","diff_url":"https://github.com/contao/core-bundle/pull/575.diff","patch_url":"https://github.com/contao/core-bundle/pull/575.patch","issue_url":"https://api.github.com/repos/contao/core-bundle/issues/575","number":575,"state":"open","locked":false,"title":"[WIP] Feature/no more superglobals","user":{"login":"discordier","id":940331,"avatar_url":"https://avatars.githubusercontent.com/u/940331?v=3","gravatar_id":"","url":"https://api.github.com/users/discordier","html_url":"https://github.com/discordier","followers_url":"https://api.github.com/users/discordier/followers","following_url":"https://api.github.com/users/discordier/following{/other_user}","gists_url":"https://api.github.com/users/discordier/gists{/gist_id}","starred_url":"https://api.github.com/users/discordier/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/discordier/subscriptions","organizations_url":"https://api.github.com/users/discordier/orgs","repos_url":"https://api.github.com/users/discordier/repos","events_url":"https://api.github.com/users/discordier/events{/privacy}","received_events_url":"https://api.github.com/users/discordier/received_events","type":"User","site_admin":false},"body":"This PR tries to remove the dependency on the super global arrays `$_SERVER`, `$_GET`, `$_POST` and  `$_COOKIE`.\r\n\r\nIt does so by registering a new listener which is executed upon every request prior and after the request has been handled.\r\n\r\nThings to do:\r\n- [X] Make class `\\Contao\\Environment` independent of super globals.\r\n- [X] Make class `\\Contao\\Input` independent of super globals (It still holds a dependency on `$_SESSION` which can not be solved in the current state - we need to discuss).\r\n  - [X] Link the filtered request values to the super globals.\r\n- [X] Make class `ValueAdapter` final so no one will tamper with it 71c861f.\r\n- [X] Utilize `return self::$objRequest->isXmlHttpRequest();` in `Environment` d8bee92.\r\n- [ ] Remove access to super globals from the core where possible (rewrite to use the request directly).\r\n- [ ] Remove access to `Environment` and `Input` from the core where possible (rewrite to use the request directly).\r\n- [x] Use scopes in `LegacyRequestValueSynchronizingListener` 2c27fb1.\r\n\r\nSome words about the implementation:\r\nI tried to keep the changes to an absolute minimum while maintaining the maximum of backwards compatibility, therefore the whole input filtering is still in the input class and hence still not unit tested.\r\nI'd prefer to move the filter stuff into `Utils\\InputFilter` or something like that as they are completely unrelated to the input itself (aside from caching), even as we intend to remove all of this for Contao 5 it would be better to move the XSS checks and the like into an own class as the `Input` class would become a pretty small delegator then.\r\n\r\nSo far I have not run into any bc breaks, if you find some, please comment.\r\n\r\nThings to decide:\r\n\r\n* Move enconding methods from `\\Input` to `StringUtil`\r\n  - [ ] `\\Input::stripTags` (Strip HTML and PHP tags preserving HTML comments).\r\n  - [ ] `\\Input::decodeEntities` (Decode HTML entities - will be needed for converting the current DB values to unencoded values in Contao 5 when we switch to output encoding).\r\n  - [ ] `\\Input::preserveBasicEntities` (Preserve basic entities by replacing them with square brackets (e.g. `&amp;` becomes `[amp]` - comes in handy when working with the RTE and we have the restoreBasicEntities in `StringUtil` already so why not also this method?)).\r\n  - [ ] `\\Input::encodeSpecialChars` (Encode special characters which are potentially dangerous, these are: `[#<>()\\=]`).\r\n  - [ ] `\\Input::encodeInsertTags` (Encode the opening and closing delimiters of insert tags - don't know if we still need this when we have fragments).","created_at":"2016-08-30T01:42:51Z","updated_at":"2016-11-09T05:34:11Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b7344bf8174971313d7fb27a55f3a0a1dad4560c","assignee":{"login":"discordier","id":940331,"avatar_url":"https://avatars.githubusercontent.com/u/940331?v=3","gravatar_id":"","url":"https://api.github.com/users/discordier","html_url":"https://github.com/discordier","followers_url":"https://api.github.com/users/discordier/followers","following_url":"https://api.github.com/users/discordier/following{/other_user}","gists_url":"https://api.github.com/users/discordier/gists{/gist_id}","starred_url":"https://api.github.com/users/discordier/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/discordier/subscriptions","organizations_url":"https://api.github.com/users/discordier/orgs","repos_url":"https://api.github.com/users/discordier/repos","events_url":"https://api.github.com/users/discordier/events{/privacy}","received_events_url":"https://api.github.com/users/discordier/received_events","type":"User","site_admin":false},"assignees":[{"login":"discordier","id":940331,"avatar_url":"https://avatars.githubusercontent.com/u/940331?v=3","gravatar_id":"","url":"https://api.github.com/users/discordier","html_url":"https://github.com/discordier","followers_url":"https://api.github.com/users/discordier/followers","following_url":"https://api.github.com/users/discordier/following{/other_user}","gists_url":"https://api.github.com/users/discordier/gists{/gist_id}","starred_url":"https://api.github.com/users/discordier/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/discordier/subscriptions","organizations_url":"https://api.github.com/users/discordier/orgs","repos_url":"https://api.github.com/users/discordier/repos","events_url":"https://api.github.com/users/discordier/events{/privacy}","received_events_url":"https://api.github.com/users/discordier/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/contao/core-bundle/pulls/575/commits","review_comments_url":"https://api.github.com/repos/contao/core-bundle/pulls/575/comments","review_comment_url":"https://api.github.com/repos/contao/core-bundle/pulls/comments{/number}","comments_url":"https://api.github.com/repos/contao/core-bundle/issues/575/comments","statuses_url":"https://api.github.com/repos/contao/core-bundle/statuses/d96a654cf34f1768242c20f822d41b313b9e08b5","head":{"label":"discordier:feature/no-more-superglobals","ref":"feature/no-more-superglobals","sha":"d96a654cf34f1768242c20f822d41b313b9e08b5","user":{"login":"discordier","id":940331,"avatar_url":"https://avatars.githubusercontent.com/u/940331?v=3","gravatar_id":"","url":"https://api.github.com/users/discordier","html_url":"https://github.com/discordier","followers_url":"https://api.github.com/users/discordier/followers","following_url":"https://api.github.com/users/discordier/following{/other_user}","gists_url":"https://api.github.com/users/discordier/gists{/gist_id}","starred_url":"https://api.github.com/users/discordier/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/discordier/subscriptions","organizations_url":"https://api.github.com/users/discordier/orgs","repos_url":"https://api.github.com/users/discordier/repos","events_url":"https://api.github.com/users/discordier/events{/privacy}","received_events_url":"https://api.github.com/users/discordier/received_events","type":"User","site_admin":false},"repo":{"id":25869758,"name":"core-bundle","full_name":"discordier/core-bundle","owner":{"login":"discordier","id":940331,"avatar_url":"https://avatars.githubusercontent.com/u/940331?v=3","gravatar_id":"","url":"https://api.github.com/users/discordier","html_url":"https://github.com/discordier","followers_url":"https://api.github.com/users/discordier/followers","following_url":"https://api.github.com/users/discordier/following{/other_user}","gists_url":"https://api.github.com/users/discordier/gists{/gist_id}","starred_url":"https://api.github.com/users/discordier/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/discordier/subscriptions","organizations_url":"https://api.github.com/users/discordier/orgs","repos_url":"https://api.github.com/users/discordier/repos","events_url":"https://api.github.com/users/discordier/events{/privacy}","received_events_url":"https://api.github.com/users/discordier/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/discordier/core-bundle","description":"Contao 4 core module","fork":true,"url":"https://api.github.com/repos/discordier/core-bundle","forks_url":"https://api.github.com/repos/discordier/core-bundle/forks","keys_url":"https://api.github.com/repos/discordier/core-bundle/keys{/key_id}","collaborators_url":"https://api.github.com/repos/discordier/core-bundle/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/discordier/core-bundle/teams","hooks_url":"https://api.github.com/repos/discordier/core-bundle/hooks","issue_events_url":"https://api.github.com/repos/discordier/core-bundle/issues/events{/number}","events_url":"https://api.github.com/repos/discordier/core-bundle/events","assignees_url":"https://api.github.com/repos/discordier/core-bundle/assignees{/user}","branches_url":"https://api.github.com/repos/discordier/core-bundle/branches{/branch}","tags_url":"https://api.github.com/repos/discordier/core-bundle/tags","blobs_url":"https://api.github.com/repos/discordier/core-bundle/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/discordier/core-bundle/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/discordier/core-bundle/git/refs{/sha}","trees_url":"https://api.github.com/repos/discordier/core-bundle/git/trees{/sha}","statuses_url":"https://api.github.com/repos/discordier/core-bundle/statuses/{sha}","languages_url":"https://api.github.com/repos/discordier/core-bundle/languages","stargazers_url":"https://api.github.com/repos/discordier/core-bundle/stargazers","contributors_url":"https://api.github.com/repos/discordier/core-bundle/contributors","subscribers_url":"https://api.github.com/repos/discordier/core-bundle/subscribers","subscription_url":"https://api.github.com/repos/discordier/core-bundle/subscription","commits_url":"https://api.github.com/repos/discordier/core-bundle/commits{/sha}","git_commits_url":"https://api.github.com/repos/discordier/core-bundle/git/commits{/sha}","comments_url":"https://api.github.com/repos/discordier/core-bundle/comments{/number}","issue_comment_url":"https://api.github.com/repos/discordier/core-bundle/issues/comments{/number}","contents_url":"https://api.github.com/repos/discordier/core-bundle/contents/{+path}","compare_url":"https://api.github.com/repos/discordier/core-bundle/compare/{base}...{head}","merges_url":"https://api.github.com/repos/discordier/core-bundle/merges","archive_url":"https://api.github.com/repos/discordier/core-bundle/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/discordier/core-bundle/downloads","issues_url":"https://api.github.com/repos/discordier/core-bundle/issues{/number}","pulls_url":"https://api.github.com/repos/discordier/core-bundle/pulls{/number}","milestones_url":"https://api.github.com/repos/discordier/core-bundle/milestones{/number}","notifications_url":"https://api.github.com/repos/discordier/core-bundle/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/discordier/core-bundle/labels{/name}","releases_url":"https://api.github.com/repos/discordier/core-bundle/releases{/id}","deployments_url":"https://api.github.com/repos/discordier/core-bundle/deployments","created_at":"2014-10-28T13:09:14Z","updated_at":"2016-07-19T17:51:39Z","pushed_at":"2016-11-09T05:30:51Z","git_url":"git://github.com/discordier/core-bundle.git","ssh_url":"git@github.com:discordier/core-bundle.git","clone_url":"https://github.com/discordier/core-bundle.git","svn_url":"https://github.com/discordier/core-bundle","homepage":null,"size":28459,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"develop"}},"base":{"label":"contao:develop","ref":"develop","sha":"4176f0f00367245dde0b35e1a7d23ff2a8d91849","user":{"login":"contao","id":1206136,"avatar_url":"https://avatars.githubusercontent.com/u/1206136?v=3","gravatar_id":"","url":"https://api.github.com/users/contao","html_url":"https://github.com/contao","followers_url":"https://api.github.com/users/contao/followers","following_url":"https://api.github.com/users/contao/following{/other_user}","gists_url":"https://api.github.com/users/contao/gists{/gist_id}","starred_url":"https://api.github.com/users/contao/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/contao/subscriptions","organizations_url":"https://api.github.com/users/contao/orgs","repos_url":"https://api.github.com/users/contao/repos","events_url":"https://api.github.com/users/contao/events{/privacy}","received_events_url":"https://api.github.com/users/contao/received_events","type":"Organization","site_admin":false},"repo":{"id":20519851,"name":"core-bundle","full_name":"contao/core-bundle","owner":{"login":"contao","id":1206136,"avatar_url":"https://avatars.githubusercontent.com/u/1206136?v=3","gravatar_id":"","url":"https://api.github.com/users/contao","html_url":"https://github.com/contao","followers_url":"https://api.github.com/users/contao/followers","following_url":"https://api.github.com/users/contao/following{/other_user}","gists_url":"https://api.github.com/users/contao/gists{/gist_id}","starred_url":"https://api.github.com/users/contao/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/contao/subscriptions","organizations_url":"https://api.github.com/users/contao/orgs","repos_url":"https://api.github.com/users/contao/repos","events_url":"https://api.github.com/users/contao/events{/privacy}","received_events_url":"https://api.github.com/users/contao/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/contao/core-bundle","description":"Contao 4 core bundle","fork":false,"url":"https://api.github.com/repos/contao/core-bundle","forks_url":"https://api.github.com/repos/contao/core-bundle/forks","keys_url":"https://api.github.com/repos/contao/core-bundle/keys{/key_id}","collaborators_url":"https://api.github.com/repos/contao/core-bundle/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/contao/core-bundle/teams","hooks_url":"https://api.github.com/repos/contao/core-bundle/hooks","issue_events_url":"https://api.github.com/repos/contao/core-bundle/issues/events{/number}","events_url":"https://api.github.com/repos/contao/core-bundle/events","assignees_url":"https://api.github.com/repos/contao/core-bundle/assignees{/user}","branches_url":"https://api.github.com/repos/contao/core-bundle/branches{/branch}","tags_url":"https://api.github.com/repos/contao/core-bundle/tags","blobs_url":"https://api.github.com/repos/contao/core-bundle/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/contao/core-bundle/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/contao/core-bundle/git/refs{/sha}","trees_url":"https://api.github.com/repos/contao/core-bundle/git/trees{/sha}","statuses_url":"https://api.github.com/repos/contao/core-bundle/statuses/{sha}","languages_url":"https://api.github.com/repos/contao/core-bundle/languages","stargazers_url":"https://api.github.com/repos/contao/core-bundle/stargazers","contributors_url":"https://api.github.com/repos/contao/core-bundle/contributors","subscribers_url":"https://api.github.com/repos/contao/core-bundle/subscribers","subscription_url":"https://api.github.com/repos/contao/core-bundle/subscription","commits_url":"https://api.github.com/repos/contao/core-bundle/commits{/sha}","git_commits_url":"https://api.github.com/repos/contao/core-bundle/git/commits{/sha}","comments_url":"https://api.github.com/repos/contao/core-bundle/comments{/number}","issue_comment_url":"https://api.github.com/repos/contao/core-bundle/issues/comments{/number}","contents_url":"https://api.github.com/repos/contao/core-bundle/contents/{+path}","compare_url":"https://api.github.com/repos/contao/core-bundle/compare/{base}...{head}","merges_url":"https://api.github.com/repos/contao/core-bundle/merges","archive_url":"https://api.github.com/repos/contao/core-bundle/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/contao/core-bundle/downloads","issues_url":"https://api.github.com/repos/contao/core-bundle/issues{/number}","pulls_url":"https://api.github.com/repos/contao/core-bundle/pulls{/number}","milestones_url":"https://api.github.com/repos/contao/core-bundle/milestones{/number}","notifications_url":"https://api.github.com/repos/contao/core-bundle/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/contao/core-bundle/labels{/name}","releases_url":"https://api.github.com/repos/contao/core-bundle/releases{/id}","deployments_url":"https://api.github.com/repos/contao/core-bundle/deployments","created_at":"2014-06-05T09:45:55Z","updated_at":"2016-10-30T12:07:23Z","pushed_at":"2016-11-09T05:30:51Z","git_url":"git://github.com/contao/core-bundle.git","ssh_url":"git@github.com:contao/core-bundle.git","clone_url":"https://github.com/contao/core-bundle.git","svn_url":"https://github.com/contao/core-bundle","homepage":"","size":64863,"stargazers_count":40,"watchers_count":40,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":21,"mirror_url":null,"open_issues_count":48,"forks":21,"open_issues":48,"watchers":40,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/contao/core-bundle/pulls/575"},"html":{"href":"https://github.com/contao/core-bundle/pull/575"},"issue":{"href":"https://api.github.com/repos/contao/core-bundle/issues/575"},"comments":{"href":"https://api.github.com/repos/contao/core-bundle/issues/575/comments"},"review_comments":{"href":"https://api.github.com/repos/contao/core-bundle/pulls/575/comments"},"review_comment":{"href":"https://api.github.com/repos/contao/core-bundle/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/contao/core-bundle/pulls/575/commits"},"statuses":{"href":"https://api.github.com/repos/contao/core-bundle/statuses/d96a654cf34f1768242c20f822d41b313b9e08b5"}}}}
{"actor":{"display_login":"discordier"}}