{"action":"closed","issue":{"url":"https://api.github.com/repos/symfony/symfony/issues/23474","repository_url":"https://api.github.com/repos/symfony/symfony","labels_url":"https://api.github.com/repos/symfony/symfony/issues/23474/labels{/name}","comments_url":"https://api.github.com/repos/symfony/symfony/issues/23474/comments","events_url":"https://api.github.com/repos/symfony/symfony/issues/23474/events","html_url":"https://github.com/symfony/symfony/issues/23474","id":241964813,"number":23474,"title":"[Yaml] Escaper::requiresSingleQuoting() returns wrong result","user":{"login":"leofeyer","id":1192057,"avatar_url":"https://avatars3.githubusercontent.com/u/1192057?v=3","gravatar_id":"","url":"https://api.github.com/users/leofeyer","html_url":"https://github.com/leofeyer","followers_url":"https://api.github.com/users/leofeyer/followers","following_url":"https://api.github.com/users/leofeyer/following{/other_user}","gists_url":"https://api.github.com/users/leofeyer/gists{/gist_id}","starred_url":"https://api.github.com/users/leofeyer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/leofeyer/subscriptions","organizations_url":"https://api.github.com/users/leofeyer/orgs","repos_url":"https://api.github.com/users/leofeyer/repos","events_url":"https://api.github.com/users/leofeyer/events{/privacy}","received_events_url":"https://api.github.com/users/leofeyer/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2017-07-11T08:20:10Z","updated_at":"2017-07-11T08:32:45Z","closed_at":"2017-07-11T08:32:45Z","body":"| Q                | A\r\n| ---------------- | -----\r\n| Bug report?      | yes\r\n| Feature request? | no\r\n| BC Break report? | no\r\n| Symfony version  | 3.3.2\r\n\r\nThe [documentation](https://symfony.com/doc/current/components/yaml/yaml_format.html#strings) says:\r\n\r\n> Strings **containing** any of the following characters must be quoted. Although you can use double quotes, for these characters it is more convenient to use single quotes, which avoids having to escape any backslash ``\\``:\r\n>\r\n> * ``:``, ``{``, ``}``, ``[``, ``]``, ``,``, ``&``, ``*``, ``#``, ``?``, ``|``, ``-``, ``<``, ``>``, ``=``, ``!``, ``%``, ``@``, `\r\n\r\nHowever, the [`Escaper::requiresSingleQuoting()`](https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Yaml/Escaper.php#L87) method uses the following regex:\r\n\r\n```php\r\npreg_match('/[ \\s \\' \" \\: \\{ \\} \\[ \\] , & \\* \\# \\?] | \\A[ \\- ? | < > = ! % @ ` ]/x', $value)\r\n```\r\n\r\nThe `\\A[ \\- ? | < > = ! % @ ` ]` part only checks whether the value **begins** with one of the characters instead of whether it **contains** one of the characters, so either the docs or the regex is wrong IMHO."}}
{"actor":{"display_login":"leofeyer"}}