{"action":"created","issue":{"url":"https://api.github.com/repos/laravel/framework/issues/10128","labels_url":"https://api.github.com/repos/laravel/framework/issues/10128/labels{/name}","comments_url":"https://api.github.com/repos/laravel/framework/issues/10128/comments","events_url":"https://api.github.com/repos/laravel/framework/issues/10128/events","html_url":"https://github.com/laravel/framework/pull/10128","id":104450325,"number":10128,"title":"[5.1] Escape square brackets in string which is used as a CSS ID selector","user":{"login":"rairlie","id":14072280,"avatar_url":"https://avatars.githubusercontent.com/u/14072280?v=3","gravatar_id":"","url":"https://api.github.com/users/rairlie","html_url":"https://github.com/rairlie","followers_url":"https://api.github.com/users/rairlie/followers","following_url":"https://api.github.com/users/rairlie/following{/other_user}","gists_url":"https://api.github.com/users/rairlie/gists{/gist_id}","starred_url":"https://api.github.com/users/rairlie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rairlie/subscriptions","organizations_url":"https://api.github.com/users/rairlie/orgs","repos_url":"https://api.github.com/users/rairlie/repos","events_url":"https://api.github.com/users/rairlie/events{/privacy}","received_events_url":"https://api.github.com/users/rairlie/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-09-02T10:35:51Z","updated_at":"2015-09-16T09:48:28Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/laravel/framework/pulls/10128","html_url":"https://github.com/laravel/framework/pull/10128","diff_url":"https://github.com/laravel/framework/pull/10128.diff","patch_url":"https://github.com/laravel/framework/pull/10128.patch"},"body":"In my test I had an issue trying to interact with a form containing an input array, e.g:\r\n\r\n```\r\nHTML:\r\n<input name=\"foo[]\">\r\n```\r\n\r\n```\r\nTest:\r\nfunction testType {\r\n    $this->type('value', 'foo[]');\r\n}\r\n```\r\nWhen running PHPUnit you will see something like:\r\n```\r\nSymfony\\Component\\CssSelector\\Exception\\SyntaxErrorException: Expected identifier or \"*\", but <delimiter \"]\" at 6> found\r\n```\r\n\r\nThe issue is that the field name 'foo[]' is being used to build a CSS selector:\r\n```\r\n{$element}#{$name}, {$element}[name='{$name}']\r\n```\r\nwhich in this case results in:\r\n```\r\n*#foo[], *[name='foo[]']\r\n```\r\nAs you can see `*#foo[]` is not a valid ID selector, it should be escaped as `*#foo\\[\\]`. Ref: https://mathiasbynens.be/notes/css-escapes\r\n\r\nIdeally all characters that are valid in CSS selectors should be correctly escaped,\r\nthough that seems outwith the scope of this function. Probably best to have a utility class that can build W3C-compliant CSS selectors, though I'm not aware of one for PHP?"},"comment":{"url":"https://api.github.com/repos/laravel/framework/issues/comments/140690882","html_url":"https://github.com/laravel/framework/pull/10128#issuecomment-140690882","issue_url":"https://api.github.com/repos/laravel/framework/issues/10128","id":140690882,"user":{"login":"GrahamCampbell","id":2829600,"avatar_url":"https://avatars.githubusercontent.com/u/2829600?v=3","gravatar_id":"","url":"https://api.github.com/users/GrahamCampbell","html_url":"https://github.com/GrahamCampbell","followers_url":"https://api.github.com/users/GrahamCampbell/followers","following_url":"https://api.github.com/users/GrahamCampbell/following{/other_user}","gists_url":"https://api.github.com/users/GrahamCampbell/gists{/gist_id}","starred_url":"https://api.github.com/users/GrahamCampbell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GrahamCampbell/subscriptions","organizations_url":"https://api.github.com/users/GrahamCampbell/orgs","repos_url":"https://api.github.com/users/GrahamCampbell/repos","events_url":"https://api.github.com/users/GrahamCampbell/events{/privacy}","received_events_url":"https://api.github.com/users/GrahamCampbell/received_events","type":"User","site_admin":false},"created_at":"2015-09-16T09:48:28Z","updated_at":"2015-09-16T09:48:28Z","body":"We also can't merge with merge commits. Can you please rebase and force push so there is only one commit."}}