I am new to the FriendsOfSymfony UserBundle and everything has been going well until I try to have a user logout. The login works perfectly and I am using the basic configuration that I have seen on many sites. I only have 2 users that need to login. The problem occurs when the user clicks on the logout URL. In this case /logout. I receve a generic server error in the browser and the error_log shows "Premature end of script headers: app_dev.php". If I hit refresh on the error page it goes back to my home page and I am logged out successfully.
Here is my firewall section in security.yml:
firewalls:
main:
pattern: ^/
form_login:
provider: fos_userbundle
check_path: fos_user_security_check
csrf_provider: form.csrf_provider
logout: true
anonymous: true
Here is the access_control section of security.yml:
access_control:
- { path: ^/login$, role: IS_AUTHENTICATED_ANONYMOUSLY, requires_channel:https }
- { path: ^/register, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/logout, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/admin/, role: ROLE_ADMIN }
Here is the fos_user section in config.yml
fos_user:
db_driver: orm
firewall_name: main
user_class: Wielding\BassBundle\Entity\User
I am generating the logout url in my twig form with:
<a href="{{ path('fos_user_security_logout') }}">logout</a>
If I am not logged into the site and I go manually to the logout url I get redirected back to the default index page without any error. If I am logged in and manually type in the logout url I get the server error. I have tried so many variations of config changes I can't even list them here. They all failed.
I even tried to write my own logout by invalidating the session in the controller and that generates the same error.
My only clue so far is an entry in dev.log:
[2013-07-27 14:51:26] request.CRITICAL: Uncaught PHP Exception Symfony\Component\Debug\Exception\ContextErrorException: "Warning: SessionHandler::write(): Parent session handler is not open in /home/dev2/app/cache/dev/classes.php line 407" at /home/dev2/app/cache/dev/classes.php line 407 {"exception":"[object] (Symfony\\Component\\Debug\\Exception\\ContextErrorException: Warning: SessionHandler::write(): Parent session handler is not open in /home/dev2/app/cache/dev/classes.php line 407 at /home/dev2/app/cache/dev/classes.php:407)"} []
Searching on this initially indicated that this was not something to worry about but I am out of other ideas. This is my final task in getting security working and its freaking me out.
I will gladly provide any other information needed to help solve this really annoying problem. Thanks in advance for any assistance.