3

I'm trying to start working in a new (Windows 8) laptop in an existing project that works fine in my previous (Mac OS X) machine and in all the (Linux) servers it's been deployed to.

I've cloned from git, run the composer, app/console works fine, I've set the config files properly, created the database and checked that the DB schema was OK, cleared cache, etc etc as I've done a thousand times before.

But now I'm getting an error I've never faced before, and I don't know if it has to do with updated dependencies that might not necessarily use the exact same versions than before, or just that I'm kind of new working on Windows environments:

[1] RuntimeException: Failed to start the session because headers have already been sent by "" at line 0.
at n/a
    in C:\Users\David\Sites\my-project\app\cache\dev\classes.php line 103

at Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage->start()
    in C:\Users\David\Sites\my-project\app\cache\dev\classes.php line 183

at Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage->getBag('attributes')
    in C:\Users\David\Sites\my-project\app\cache\dev\classes.php line 475

at Symfony\Component\HttpFoundation\Session\Session->has('_security.last_error')
    in C:\Users\David\Sites\my-project\vendor\friendsofsymfony\user-bundle\FOS\UserBundle\Controller\SecurityController.php line 28

at FOS\UserBundle\Controller\SecurityController->loginAction(object(Request))
    in  line 

at call_user_func_array(array(object(SecurityController), 'loginAction'), array(object(Request)))
    in C:\Users\David\Sites\my-project\app\bootstrap.php.cache line 2841

at Symfony\Component\HttpKernel\HttpKernel->handleRaw(object(Request), '1')
    in C:\Users\David\Sites\my-project\app\bootstrap.php.cache line 2815

at Symfony\Component\HttpKernel\HttpKernel->handle(object(Request), '1', true)
    in C:\Users\David\Sites\my-project\app\bootstrap.php.cache line 2944

at Symfony\Component\HttpKernel\DependencyInjection\ContainerAwareHttpKernel->handle(object(Request), '1', true)
    in C:\Users\David\Sites\my-project\app\bootstrap.php.cache line 2245

at Symfony\Component\HttpKernel\Kernel->handle(object(Request))
    in C:\Users\David\Sites\my-project\web\app_dev.php line 29
davidvelilla
  • 488
  • 5
  • 18
  • 1
    This may be caused by file encodings. When you clone it to windows and opened it with text editor, file encoding may be changed. – Hüseyin BABAL Feb 21 '14 at 13:11
  • Your other servers likely have output buffering enabled. The problem occurs because you output html (intentionally or have display_errors enabled) before attempting to set a header. You can use `ob_start()` at the top of `app\bootstrap.php` to work around this. – Andrew Mackrodt Feb 21 '14 at 13:17

1 Answers1

0

Check that any custom classes overriding classes from the HttpKernel, for example the Bundle class are not sending headers or responses from one of the methods like boot()

Adam Elsodaney
  • 7,722
  • 6
  • 39
  • 65