PadLock Posted February 18, 2016 Share Posted February 18, 2016 Hi. First post here. I am currently developing an application for a client. We elected to go with Symfony 3 and PHP 7 for the build to give it a longer lifespan. I am currently working with session management and it appears that for some reason Symfony is auto starting the session. I am entirely unsure why it is doing this or where it is being told to. I verified that the session auto start was disabled in php.ini and I have check the YML config files for Symfony. I tested for this with the following code: $session = $this->container->get('session')->isStarted(); echo $session; exit(); It returned a value of 1. What am I missing? Quote Link to comment https://forums.phpfreaks.com/topic/300838-sessions-in-symfony-3/ Share on other sites More sharing options...
QuickOldCar Posted February 18, 2016 Share Posted February 18, 2016 http://symfony.com/doc/current/components/http_foundation/sessions.html Symfony sessions are designed to replace several native PHP functions. Applications should avoid using session_start(), session_regenerate_id(), session_id(), session_name(), and session_destroy() and instead use the APIs in the following section. While it is recommended to explicitly start a session, a session will actually start on demand, that is, if any session request is made to read/write session data. Symfony sessions are incompatible with php.ini directive session.auto_start = 1 This directive should be turned off in php.ini, in the webserver directives or in .htaccess. 1 Quote Link to comment https://forums.phpfreaks.com/topic/300838-sessions-in-symfony-3/#findComment-1531239 Share on other sites More sharing options...
ignace Posted February 18, 2016 Share Posted February 18, 2016 (edited) As already said. A session will be started by reading, writing, or even checking the session. http://symfony.com/doc/current/cookbook/session/avoid_session_start.html Edited February 18, 2016 by ignace 1 Quote Link to comment https://forums.phpfreaks.com/topic/300838-sessions-in-symfony-3/#findComment-1531251 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.