{"action":"created","comment":{"url":"https://api.github.com/repos/nette/http/pulls/comments/24997808","id":24997808,"diff_hunk":"@@ -112,19 +112,20 @@ public function createHttpRequest()\n \t\t}\n \n \t\t// remove invalid characters\n+\t\t$reChars = '#^[' . self::CHARS . ']*+\\z#u';\n \t\tif (!$this->binary) {\n \t\t\t$list = array(& $query, & $post, & $cookies);\n \t\t\twhile (list($key, $val) = each($list)) {\n \t\t\t\tforeach ($val as $k => $v) {\n-\t\t\t\t\tif (is_string($k) && (!preg_match(self::CHARS, $k) || preg_last_error())) {\n+\t\t\t\t\tif (is_string($k) && (!preg_match($reChars, $k) || preg_last_error())) {\n \t\t\t\t\t\tunset($list[$key][$k]);\n \n \t\t\t\t\t} elseif (is_array($v)) {\n \t\t\t\t\t\t$list[$key][$k] = $v;\n \t\t\t\t\t\t$list[] = & $list[$key][$k];\n \n-\t\t\t\t\t} elseif (!preg_match(self::CHARS, $v) || preg_last_error()) {\n-\t\t\t\t\t\t$list[$key][$k] = '';\n+\t\t\t\t\t} else {\n+\t\t\t\t\t\t$list[$key][$k] = (string) preg_replace('#[^' . self::CHARS . ']+#u', '', $v);","path":"src/Http/RequestFactory.php","position":29,"original_position":29,"commit_id":"091f14160a44fa1a3e8448406418ec05f5da384d","original_commit_id":"091f14160a44fa1a3e8448406418ec05f5da384d","user":{"login":"dg","id":194960,"avatar_url":"https://avatars.githubusercontent.com/u/194960?v=3","gravatar_id":"","url":"https://api.github.com/users/dg","html_url":"https://github.com/dg","followers_url":"https://api.github.com/users/dg/followers","following_url":"https://api.github.com/users/dg/following{/other_user}","gists_url":"https://api.github.com/users/dg/gists{/gist_id}","starred_url":"https://api.github.com/users/dg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dg/subscriptions","organizations_url":"https://api.github.com/users/dg/orgs","repos_url":"https://api.github.com/users/dg/repos","events_url":"https://api.github.com/users/dg/events{/privacy}","received_events_url":"https://api.github.com/users/dg/received_events","type":"User","site_admin":false},"body":"Didn't but utf-8 check is extreme fast.","created_at":"2015-02-19T15:54:41Z","updated_at":"2015-02-19T15:54:41Z","html_url":"https://github.com/nette/http/pull/55#discussion_r24997808","pull_request_url":"https://api.github.com/repos/nette/http/pulls/55","_links":{"self":{"href":"https://api.github.com/repos/nette/http/pulls/comments/24997808"},"html":{"href":"https://github.com/nette/http/pull/55#discussion_r24997808"},"pull_request":{"href":"https://api.github.com/repos/nette/http/pulls/55"}}},"pull_request":{"url":"https://api.github.com/repos/nette/http/pulls/55","id":29620601,"html_url":"https://github.com/nette/http/pull/55","diff_url":"https://github.com/nette/http/pull/55.diff","patch_url":"https://github.com/nette/http/pull/55.patch","issue_url":"https://api.github.com/repos/nette/http/issues/55","number":55,"state":"open","locked":false,"title":"HttpRequest: drops non-UTF8 strings, but control characters only removes...","user":{"login":"dg","id":194960,"avatar_url":"https://avatars.githubusercontent.com/u/194960?v=3","gravatar_id":"","url":"https://api.github.com/users/dg","html_url":"https://github.com/dg","followers_url":"https://api.github.com/users/dg/followers","following_url":"https://api.github.com/users/dg/following{/other_user}","gists_url":"https://api.github.com/users/dg/gists{/gist_id}","starred_url":"https://api.github.com/users/dg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dg/subscriptions","organizations_url":"https://api.github.com/users/dg/orgs","repos_url":"https://api.github.com/users/dg/repos","events_url":"https://api.github.com/users/dg/events{/privacy}","received_events_url":"https://api.github.com/users/dg/received_events","type":"User","site_admin":false},"body":"http://forum.nette.org/cs/22233-sanitizace-dat-v-httprequestu","created_at":"2015-02-19T15:33:00Z","updated_at":"2015-02-19T15:54:41Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e83f4f2360bd8eafb14e673d099852cd74b8775e","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/nette/http/pulls/55/commits","review_comments_url":"https://api.github.com/repos/nette/http/pulls/55/comments","review_comment_url":"https://api.github.com/repos/nette/http/pulls/comments/{number}","comments_url":"https://api.github.com/repos/nette/http/issues/55/comments","statuses_url":"https://api.github.com/repos/nette/http/statuses/091f14160a44fa1a3e8448406418ec05f5da384d","head":{"label":"dg:pull-cc","ref":"pull-cc","sha":"091f14160a44fa1a3e8448406418ec05f5da384d","user":{"login":"dg","id":194960,"avatar_url":"https://avatars.githubusercontent.com/u/194960?v=3","gravatar_id":"","url":"https://api.github.com/users/dg","html_url":"https://github.com/dg","followers_url":"https://api.github.com/users/dg/followers","following_url":"https://api.github.com/users/dg/following{/other_user}","gists_url":"https://api.github.com/users/dg/gists{/gist_id}","starred_url":"https://api.github.com/users/dg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dg/subscriptions","organizations_url":"https://api.github.com/users/dg/orgs","repos_url":"https://api.github.com/users/dg/repos","events_url":"https://api.github.com/users/dg/events{/privacy}","received_events_url":"https://api.github.com/users/dg/received_events","type":"User","site_admin":false},"repo":{"id":18046027,"name":"nette-http","full_name":"dg/nette-http","owner":{"login":"dg","id":194960,"avatar_url":"https://avatars.githubusercontent.com/u/194960?v=3","gravatar_id":"","url":"https://api.github.com/users/dg","html_url":"https://github.com/dg","followers_url":"https://api.github.com/users/dg/followers","following_url":"https://api.github.com/users/dg/following{/other_user}","gists_url":"https://api.github.com/users/dg/gists{/gist_id}","starred_url":"https://api.github.com/users/dg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dg/subscriptions","organizations_url":"https://api.github.com/users/dg/orgs","repos_url":"https://api.github.com/users/dg/repos","events_url":"https://api.github.com/users/dg/events{/privacy}","received_events_url":"https://api.github.com/users/dg/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/dg/nette-http","description":"Nette HTTP Component","fork":true,"url":"https://api.github.com/repos/dg/nette-http","forks_url":"https://api.github.com/repos/dg/nette-http/forks","keys_url":"https://api.github.com/repos/dg/nette-http/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dg/nette-http/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dg/nette-http/teams","hooks_url":"https://api.github.com/repos/dg/nette-http/hooks","issue_events_url":"https://api.github.com/repos/dg/nette-http/issues/events{/number}","events_url":"https://api.github.com/repos/dg/nette-http/events","assignees_url":"https://api.github.com/repos/dg/nette-http/assignees{/user}","branches_url":"https://api.github.com/repos/dg/nette-http/branches{/branch}","tags_url":"https://api.github.com/repos/dg/nette-http/tags","blobs_url":"https://api.github.com/repos/dg/nette-http/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dg/nette-http/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dg/nette-http/git/refs{/sha}","trees_url":"https://api.github.com/repos/dg/nette-http/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dg/nette-http/statuses/{sha}","languages_url":"https://api.github.com/repos/dg/nette-http/languages","stargazers_url":"https://api.github.com/repos/dg/nette-http/stargazers","contributors_url":"https://api.github.com/repos/dg/nette-http/contributors","subscribers_url":"https://api.github.com/repos/dg/nette-http/subscribers","subscription_url":"https://api.github.com/repos/dg/nette-http/subscription","commits_url":"https://api.github.com/repos/dg/nette-http/commits{/sha}","git_commits_url":"https://api.github.com/repos/dg/nette-http/git/commits{/sha}","comments_url":"https://api.github.com/repos/dg/nette-http/comments{/number}","issue_comment_url":"https://api.github.com/repos/dg/nette-http/issues/comments/{number}","contents_url":"https://api.github.com/repos/dg/nette-http/contents/{+path}","compare_url":"https://api.github.com/repos/dg/nette-http/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dg/nette-http/merges","archive_url":"https://api.github.com/repos/dg/nette-http/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dg/nette-http/downloads","issues_url":"https://api.github.com/repos/dg/nette-http/issues{/number}","pulls_url":"https://api.github.com/repos/dg/nette-http/pulls{/number}","milestones_url":"https://api.github.com/repos/dg/nette-http/milestones{/number}","notifications_url":"https://api.github.com/repos/dg/nette-http/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dg/nette-http/labels{/name}","releases_url":"https://api.github.com/repos/dg/nette-http/releases{/id}","created_at":"2014-03-23T23:11:58Z","updated_at":"2015-02-01T23:59:21Z","pushed_at":"2015-02-19T15:32:48Z","git_url":"git://github.com/dg/nette-http.git","ssh_url":"git@github.com:dg/nette-http.git","clone_url":"https://github.com/dg/nette-http.git","svn_url":"https://github.com/dg/nette-http","homepage":"","size":689,"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":"master"}},"base":{"label":"nette:master","ref":"master","sha":"03a422bd41786181691815d1587f4cebf12ff5d5","user":{"login":"nette","id":99965,"avatar_url":"https://avatars.githubusercontent.com/u/99965?v=3","gravatar_id":"","url":"https://api.github.com/users/nette","html_url":"https://github.com/nette","followers_url":"https://api.github.com/users/nette/followers","following_url":"https://api.github.com/users/nette/following{/other_user}","gists_url":"https://api.github.com/users/nette/gists{/gist_id}","starred_url":"https://api.github.com/users/nette/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nette/subscriptions","organizations_url":"https://api.github.com/users/nette/orgs","repos_url":"https://api.github.com/users/nette/repos","events_url":"https://api.github.com/users/nette/events{/privacy}","received_events_url":"https://api.github.com/users/nette/received_events","type":"Organization","site_admin":false},"repo":{"id":17694028,"name":"http","full_name":"nette/http","owner":{"login":"nette","id":99965,"avatar_url":"https://avatars.githubusercontent.com/u/99965?v=3","gravatar_id":"","url":"https://api.github.com/users/nette","html_url":"https://github.com/nette","followers_url":"https://api.github.com/users/nette/followers","following_url":"https://api.github.com/users/nette/following{/other_user}","gists_url":"https://api.github.com/users/nette/gists{/gist_id}","starred_url":"https://api.github.com/users/nette/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nette/subscriptions","organizations_url":"https://api.github.com/users/nette/orgs","repos_url":"https://api.github.com/users/nette/repos","events_url":"https://api.github.com/users/nette/events{/privacy}","received_events_url":"https://api.github.com/users/nette/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/nette/http","description":"Nette HTTP: layer for the HTTP request & response","fork":false,"url":"https://api.github.com/repos/nette/http","forks_url":"https://api.github.com/repos/nette/http/forks","keys_url":"https://api.github.com/repos/nette/http/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nette/http/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nette/http/teams","hooks_url":"https://api.github.com/repos/nette/http/hooks","issue_events_url":"https://api.github.com/repos/nette/http/issues/events{/number}","events_url":"https://api.github.com/repos/nette/http/events","assignees_url":"https://api.github.com/repos/nette/http/assignees{/user}","branches_url":"https://api.github.com/repos/nette/http/branches{/branch}","tags_url":"https://api.github.com/repos/nette/http/tags","blobs_url":"https://api.github.com/repos/nette/http/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nette/http/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nette/http/git/refs{/sha}","trees_url":"https://api.github.com/repos/nette/http/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nette/http/statuses/{sha}","languages_url":"https://api.github.com/repos/nette/http/languages","stargazers_url":"https://api.github.com/repos/nette/http/stargazers","contributors_url":"https://api.github.com/repos/nette/http/contributors","subscribers_url":"https://api.github.com/repos/nette/http/subscribers","subscription_url":"https://api.github.com/repos/nette/http/subscription","commits_url":"https://api.github.com/repos/nette/http/commits{/sha}","git_commits_url":"https://api.github.com/repos/nette/http/git/commits{/sha}","comments_url":"https://api.github.com/repos/nette/http/comments{/number}","issue_comment_url":"https://api.github.com/repos/nette/http/issues/comments/{number}","contents_url":"https://api.github.com/repos/nette/http/contents/{+path}","compare_url":"https://api.github.com/repos/nette/http/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nette/http/merges","archive_url":"https://api.github.com/repos/nette/http/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nette/http/downloads","issues_url":"https://api.github.com/repos/nette/http/issues{/number}","pulls_url":"https://api.github.com/repos/nette/http/pulls{/number}","milestones_url":"https://api.github.com/repos/nette/http/milestones{/number}","notifications_url":"https://api.github.com/repos/nette/http/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nette/http/labels{/name}","releases_url":"https://api.github.com/repos/nette/http/releases{/id}","created_at":"2014-03-13T03:46:16Z","updated_at":"2015-02-18T16:29:49Z","pushed_at":"2015-02-18T16:29:47Z","git_url":"git://github.com/nette/http.git","ssh_url":"git@github.com:nette/http.git","clone_url":"https://github.com/nette/http.git","svn_url":"https://github.com/nette/http","homepage":"http://nette.org","size":1650,"stargazers_count":59,"watchers_count":59,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":14,"mirror_url":null,"open_issues_count":11,"forks":14,"open_issues":11,"watchers":59,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/nette/http/pulls/55"},"html":{"href":"https://github.com/nette/http/pull/55"},"issue":{"href":"https://api.github.com/repos/nette/http/issues/55"},"comments":{"href":"https://api.github.com/repos/nette/http/issues/55/comments"},"review_comments":{"href":"https://api.github.com/repos/nette/http/pulls/55/comments"},"review_comment":{"href":"https://api.github.com/repos/nette/http/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/nette/http/pulls/55/commits"},"statuses":{"href":"https://api.github.com/repos/nette/http/statuses/091f14160a44fa1a3e8448406418ec05f5da384d"}}}}