{"action":"created","issue":{"url":"https://api.github.com/repos/mantisbt/mantisbt/issues/761","repository_url":"https://api.github.com/repos/mantisbt/mantisbt","labels_url":"https://api.github.com/repos/mantisbt/mantisbt/issues/761/labels{/name}","comments_url":"https://api.github.com/repos/mantisbt/mantisbt/issues/761/comments","events_url":"https://api.github.com/repos/mantisbt/mantisbt/issues/761/events","html_url":"https://github.com/mantisbt/mantisbt/pull/761","id":150343635,"number":761,"title":"Parse complex configs using PHP tokenizer","user":{"login":"dregad","id":449891,"avatar_url":"https://avatars.githubusercontent.com/u/449891?v=3","gravatar_id":"","url":"https://api.github.com/users/dregad","html_url":"https://github.com/dregad","followers_url":"https://api.github.com/users/dregad/followers","following_url":"https://api.github.com/users/dregad/following{/other_user}","gists_url":"https://api.github.com/users/dregad/gists{/gist_id}","starred_url":"https://api.github.com/users/dregad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dregad/subscriptions","organizations_url":"https://api.github.com/users/dregad/orgs","repos_url":"https://api.github.com/users/dregad/repos","events_url":"https://api.github.com/users/dregad/events{/privacy}","received_events_url":"https://api.github.com/users/dregad/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2016-04-22T11:25:25Z","updated_at":"2016-04-23T23:31:28Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/mantisbt/mantisbt/pulls/761","html_url":"https://github.com/mantisbt/mantisbt/pull/761","diff_url":"https://github.com/mantisbt/mantisbt/pull/761.diff","patch_url":"https://github.com/mantisbt/mantisbt/pull/761.patch"},"body":"This PR offers an alternative approach to #756 and #757.\r\n\r\nIt Implements 2 classes to parse 'complex' config options in admin Configuration Report page using PHP tokenizer instead of relying on regular expressions.\r\n\r\n- Tokenizer calls token_get_all() to build a list of tokens from the\r\n  given code\r\n- Parser uses a Tokenizer object to convert the code (string) to an\r\n  actual PHP array variable\r\n\r\nTODO: Move classes to an API and write automated tests\r\n\r\nFixes [#20787](https://www.mantisbt.org/bugs/view.php?id=20787), [#20812](https://www.mantisbt.org/bugs/view.php?id=20812), [#20813](https://www.mantisbt.org/bugs/view.php?id=20813), [#20850](https://www.mantisbt.org/bugs/view.php?id=20850), [#20851](https://www.mantisbt.org/bugs/view.php?id=20851)\r\n\r\nAll the test cases given in the 5 issues listed above, as well as [@vboctor's notify_flags case](https://github.com/mantisbt/mantisbt/pull/756#issuecomment-210287456) were parsed successfully with this code.\r\n\r\n**This is a work-in-progress and requires further testing to ensure it works properly**. \r\n\r\nAny suggestions to include as \"tricky\" test cases for PHPUnit tests would be appreciated."},"comment":{"url":"https://api.github.com/repos/mantisbt/mantisbt/issues/comments/213852806","html_url":"https://github.com/mantisbt/mantisbt/pull/761#issuecomment-213852806","issue_url":"https://api.github.com/repos/mantisbt/mantisbt/issues/761","id":213852806,"user":{"login":"dregad","id":449891,"avatar_url":"https://avatars.githubusercontent.com/u/449891?v=3","gravatar_id":"","url":"https://api.github.com/users/dregad","html_url":"https://github.com/dregad","followers_url":"https://api.github.com/users/dregad/followers","following_url":"https://api.github.com/users/dregad/following{/other_user}","gists_url":"https://api.github.com/users/dregad/gists{/gist_id}","starred_url":"https://api.github.com/users/dregad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dregad/subscriptions","organizations_url":"https://api.github.com/users/dregad/orgs","repos_url":"https://api.github.com/users/dregad/repos","events_url":"https://api.github.com/users/dregad/events{/privacy}","received_events_url":"https://api.github.com/users/dregad/received_events","type":"User","site_admin":false},"created_at":"2016-04-23T23:31:28Z","updated_at":"2016-04-23T23:31:28Z","body":"> Only alternative is a custom array printer, that ignore keys when applicable.\r\n\r\nIndeed."}}