{"action":"created","issue":{"url":"https://api.github.com/repos/sebastianbergmann/phpunit/issues/1193","labels_url":"https://api.github.com/repos/sebastianbergmann/phpunit/issues/1193/labels{/name}","comments_url":"https://api.github.com/repos/sebastianbergmann/phpunit/issues/1193/comments","events_url":"https://api.github.com/repos/sebastianbergmann/phpunit/issues/1193/events","html_url":"https://github.com/sebastianbergmann/phpunit/issues/1193","id":29619565,"number":1193,"title":"\"headers already sent\" problem in isolated tests when running with PHAR","user":{"login":"weynhamz","id":816673,"avatar_url":"https://avatars.githubusercontent.com/u/816673?v=3","gravatar_id":"","url":"https://api.github.com/users/weynhamz","html_url":"https://github.com/weynhamz","followers_url":"https://api.github.com/users/weynhamz/followers","following_url":"https://api.github.com/users/weynhamz/following{/other_user}","gists_url":"https://api.github.com/users/weynhamz/gists{/gist_id}","starred_url":"https://api.github.com/users/weynhamz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/weynhamz/subscriptions","organizations_url":"https://api.github.com/users/weynhamz/orgs","repos_url":"https://api.github.com/users/weynhamz/repos","events_url":"https://api.github.com/users/weynhamz/events{/privacy}","received_events_url":"https://api.github.com/users/weynhamz/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":11,"created_at":"2014-03-18T04:31:08Z","updated_at":"2015-05-29T06:07:41Z","closed_at":"2014-04-30T11:49:15Z","body":"I have some code that emits headers which I have no control of, just like #720 . As suggested, I ran the test in a separated process, and it worked when running with phpunit installed by composer in the vendor/bin directory. \r\n\r\nBUT, it does not work when ran with a phpunit PHAR archive, the \"headers\" still sent, after some digging, I found that it is the first shebang line \"#!/usr/bin/env php\" in the stup.php that causes this trouble. \r\n\r\nIf the PHAR is loaded as a library by 'require', the shebang line is absolutely unnecessary.\r\n\r\nOR,  fix this by calling 'ob_start()' within the https://github.com/sebastianbergmann/phpunit/blob/master/src/Util/PHP/Template/TestCaseMethod.tpl.dist just before the loading of the phar archive, but this is not the way it should be done."},"comment":{"url":"https://api.github.com/repos/sebastianbergmann/phpunit/issues/comments/106700599","html_url":"https://github.com/sebastianbergmann/phpunit/issues/1193#issuecomment-106700599","issue_url":"https://api.github.com/repos/sebastianbergmann/phpunit/issues/1193","id":106700599,"user":{"login":"OlegKunitsyn","id":2870028,"avatar_url":"https://avatars.githubusercontent.com/u/2870028?v=3","gravatar_id":"","url":"https://api.github.com/users/OlegKunitsyn","html_url":"https://github.com/OlegKunitsyn","followers_url":"https://api.github.com/users/OlegKunitsyn/followers","following_url":"https://api.github.com/users/OlegKunitsyn/following{/other_user}","gists_url":"https://api.github.com/users/OlegKunitsyn/gists{/gist_id}","starred_url":"https://api.github.com/users/OlegKunitsyn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OlegKunitsyn/subscriptions","organizations_url":"https://api.github.com/users/OlegKunitsyn/orgs","repos_url":"https://api.github.com/users/OlegKunitsyn/repos","events_url":"https://api.github.com/users/OlegKunitsyn/events{/privacy}","received_events_url":"https://api.github.com/users/OlegKunitsyn/received_events","type":"User","site_admin":false},"created_at":"2015-05-29T06:07:41Z","updated_at":"2015-05-29T06:07:41Z","body":"PHPUnit 4.5.0 - Cannot modify header information - headers already sent by (output started at phar:///usr/local/bin/phpunit/phpunit/Util/Printer.php:137)\r\n"}}