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()
Failed to start the session because headers have already been sent by "" at line 0. at n/a
-
14-10-2022 - |
Вопрос
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
Решение
Не связан с StackOverflow