{"action":"created","issue":{"url":"https://api.github.com/repos/FoilPHP/Foil/issues/36","repository_url":"https://api.github.com/repos/FoilPHP/Foil","labels_url":"https://api.github.com/repos/FoilPHP/Foil/issues/36/labels{/name}","comments_url":"https://api.github.com/repos/FoilPHP/Foil/issues/36/comments","events_url":"https://api.github.com/repos/FoilPHP/Foil/issues/36/events","html_url":"https://github.com/FoilPHP/Foil/issues/36","id":158284427,"number":36,"title":"Some issues when creating custom helpers","user":{"login":"martynbiz","id":6215352,"avatar_url":"https://avatars.githubusercontent.com/u/6215352?v=3","gravatar_id":"","url":"https://api.github.com/users/martynbiz","html_url":"https://github.com/martynbiz","followers_url":"https://api.github.com/users/martynbiz/followers","following_url":"https://api.github.com/users/martynbiz/following{/other_user}","gists_url":"https://api.github.com/users/martynbiz/gists{/gist_id}","starred_url":"https://api.github.com/users/martynbiz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/martynbiz/subscriptions","organizations_url":"https://api.github.com/users/martynbiz/orgs","repos_url":"https://api.github.com/users/martynbiz/repos","events_url":"https://api.github.com/users/martynbiz/events{/privacy}","received_events_url":"https://api.github.com/users/martynbiz/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-06-03T03:31:53Z","updated_at":"2016-06-03T05:26:37Z","closed_at":null,"body":"Hi, I'm registering my helpers like so:\r\n\r\n```php\r\n$engine = \\Foil\\engine($settings);\r\n$engine->registerFilter('translate', function($str) use ($translator) {\r\n    // return $translator->translate($str); // disabled for now until I get the helper working\r\n    return strtoupper($str);\r\n});\r\n```\r\n\r\nThen in my template I have this:\r\n\r\n```php\r\n<?php $this->layout('layouts/main') ?>\r\n\r\n<?php $this->section('content') ?>\r\n    <p><?= $this->translate('hello_world'); ?></p>\r\n<?php $this->replace() ?>\r\n```\r\n\r\nSo registerFilter will receive the callable helper that will be registered. This is how I was doing things with Plates, the second argument can be a callable right? However, when I run the page I get errors. The errors are thrown in Slim, but when I remove the call to the helper the page renders. So I'm wondering if there is something I've done wrong with registering the helper. It seems that some characters are being output to the ob before Slim is ready to do so (although I don't really understand Slim at a deep level, I just var_dump(ob_get_clean()) before line 552 to see it output - string(4) \"    \" - and this is causing (ob_get_length() > 0) to be true, thus causing Slim to throw the RuntimeException. Any suggestions?\r\n\r\n```\r\n[Fri Jun  3 12:20:53 2016] 127.0.0.1:57408 [500]: / - Uncaught exception 'RuntimeException' with message 'Unexpected data in output buffer. Maybe you have characters before an opening <?php tag?' in /var/www/slim_modules/vendor/slim/slim/Slim/App.php:552\r\nStack trace:\r\n#0 /var/www/slim_modules/vendor/slim/slim/Slim/App.php(344): Slim\\App->finalize(Object(MartynBiz\\Slim3Controller\\Http\\Response))\r\n#1 /var/www/slim_modules/vendor/slim/slim/Slim/App.php(298): Slim\\App->process(Object(MartynBiz\\Slim3Controller\\Http\\Request), Object(MartynBiz\\Slim3Controller\\Http\\Response))\r\n#2 /var/www/slim_modules/public/index.php(91): Slim\\App->run()\r\n#3 {main}\r\n  thrown in /var/www/slim_modules/vendor/slim/slim/Slim/App.php on line 552\r\n```"},"comment":{"url":"https://api.github.com/repos/FoilPHP/Foil/issues/comments/223493676","html_url":"https://github.com/FoilPHP/Foil/issues/36#issuecomment-223493676","issue_url":"https://api.github.com/repos/FoilPHP/Foil/issues/36","id":223493676,"user":{"login":"martynbiz","id":6215352,"avatar_url":"https://avatars.githubusercontent.com/u/6215352?v=3","gravatar_id":"","url":"https://api.github.com/users/martynbiz","html_url":"https://github.com/martynbiz","followers_url":"https://api.github.com/users/martynbiz/followers","following_url":"https://api.github.com/users/martynbiz/following{/other_user}","gists_url":"https://api.github.com/users/martynbiz/gists{/gist_id}","starred_url":"https://api.github.com/users/martynbiz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/martynbiz/subscriptions","organizations_url":"https://api.github.com/users/martynbiz/orgs","repos_url":"https://api.github.com/users/martynbiz/repos","events_url":"https://api.github.com/users/martynbiz/events{/privacy}","received_events_url":"https://api.github.com/users/martynbiz/received_events","type":"User","site_admin":false},"created_at":"2016-06-03T05:26:37Z","updated_at":"2016-06-03T05:26:37Z","body":"Aaah, registerFunction!! not registerFilter (－‸ლ) Eh.. guess I can close this now"}}
{"actor":{"display_login":"martynbiz"}}