{"action":"created","issue":{"url":"https://api.github.com/repos/contao/core/issues/8436","repository_url":"https://api.github.com/repos/contao/core","labels_url":"https://api.github.com/repos/contao/core/issues/8436/labels{/name}","comments_url":"https://api.github.com/repos/contao/core/issues/8436/comments","events_url":"https://api.github.com/repos/contao/core/issues/8436/events","html_url":"https://github.com/contao/core/issues/8436","id":170602936,"number":8436,"title":"Problem in \\StringUtil::parseSimpleTokens with hyphens","user":{"login":"fritzmg","id":4970961,"avatar_url":"https://avatars.githubusercontent.com/u/4970961?v=3","gravatar_id":"","url":"https://api.github.com/users/fritzmg","html_url":"https://github.com/fritzmg","followers_url":"https://api.github.com/users/fritzmg/followers","following_url":"https://api.github.com/users/fritzmg/following{/other_user}","gists_url":"https://api.github.com/users/fritzmg/gists{/gist_id}","starred_url":"https://api.github.com/users/fritzmg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fritzmg/subscriptions","organizations_url":"https://api.github.com/users/fritzmg/orgs","repos_url":"https://api.github.com/users/fritzmg/repos","events_url":"https://api.github.com/users/fritzmg/events{/privacy}","received_events_url":"https://api.github.com/users/fritzmg/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-08-11T09:21:44Z","updated_at":"2016-08-11T09:59:59Z","closed_at":null,"body":"This issue arises in combination with [terminal42/contao-leads](https://github.com/terminal42/contao-leads) for example. Suppose you created a form in the form generator with a field named `E-mail`. Now suppose you also want to create a lead with that and you use `##E-mail##` in the __Record label__ setting, so that this field is shown in the backend, when viewing the entries of that lead.\r\n\r\nHowever, if you try to do that, you won't be able to view that lead in the backend, because there will be a script timeout or a memory overflow. The `\\Contao\\StringUtil::parseSimpleTokens` function does not work if you have a simple token with a hyphen (`-`) in it.\r\n\r\nSo currently you simply have to either avoid using field names with hyphens or avoid using field names with hyphens in the __Record label__ - however this is something that won't be clear to the regular user.\r\n\r\n@Toflar suggested that may be `\\StringUtil::parseSimpleTokens` should convert invalid chars first before running\r\n```php\r\npreg_replace('/##([A-Za-z0-9_]+)##/i', '<?php echo $arrData[\\'$1\\']; ?>', $strReturn);\r\n```"},"comment":{"url":"https://api.github.com/repos/contao/core/issues/comments/239119640","html_url":"https://github.com/contao/core/issues/8436#issuecomment-239119640","issue_url":"https://api.github.com/repos/contao/core/issues/8436","id":239119640,"user":{"login":"Toflar","id":481937,"avatar_url":"https://avatars.githubusercontent.com/u/481937?v=3","gravatar_id":"","url":"https://api.github.com/users/Toflar","html_url":"https://github.com/Toflar","followers_url":"https://api.github.com/users/Toflar/followers","following_url":"https://api.github.com/users/Toflar/following{/other_user}","gists_url":"https://api.github.com/users/Toflar/gists{/gist_id}","starred_url":"https://api.github.com/users/Toflar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Toflar/subscriptions","organizations_url":"https://api.github.com/users/Toflar/orgs","repos_url":"https://api.github.com/users/Toflar/repos","events_url":"https://api.github.com/users/Toflar/events{/privacy}","received_events_url":"https://api.github.com/users/Toflar/received_events","type":"User","site_admin":false},"created_at":"2016-08-11T09:59:59Z","updated_at":"2016-08-11T09:59:59Z","body":"This needs to be marked up for discussion anyway because I'm not happy with the behaviour of Contao at all."}}
{"actor":{"display_login":"Toflar"}}