Yes I do use Symfony and I want to use session based on a URL parameter. This URL parameter may not exist during some calls in which case I do not want to start a session. So I have set session_start to off and I am managing my own sessions. Problem is that if I turn auto_start to off, none of the session data gets saved. Same thing happens for flash. Any help would be appreciated Thanks Balaji
On May 14, 2008, at 5:54 AM, bonjour wrote: > > Set session_start at beginning pof each page if you work with php (as > we don't know which langage you use :) > > Or in the php.ini : > > session.autostart = on > > (but by default it is to off, to avoid excessive opened session, like > for include files from a "session_started" page :) > > So the question is : do you use flash with php actually. > > C ya. > > Balaji Srinivasan a écrit : >> Hi Everyone >> I posted this in the symfony-users group but didnt get any answer. >> Can someone tell me how I can make sessions work if I set >> auto_start=false? >> Right now I check if session_id returns an empty string before >> creating a new session based on a URL parameter. But then when the >> request is finished, any updates to the session are not saved. >> >> Any help would be appreciated. >> Thanks >> Balaji >> >> >> Begin forwarded message: >> >>> From: Balaji Srinivasan <[EMAIL PROTECTED]> >>> Date: May 6", 2008 11:10:28 PM PDT >>> To: [EMAIL PROTECTED] >>> Subject: Re: [symfony-users] Re: Turning off session auto_start >>> causes flash to not work >>> >>> Thanks for your reply Eno. >>> >>> I check if the session exists (ie I create a new session only if >>> session_id() returns an empty string). >>> I didnt know that getAttribute and setAttribute will not work if i >>> turn off session auto_start. What should I do to have it persist the >>> complete session information? >>> >>> (I didnt know turning off auto_start also turned off saving session >>> data at the end of the request. This might be the explanation why >>> flash doesnt work since it also uses the setAttribute, getAttribute >>> calls) >>> >>> Any Symfony developers here that can answer this question? >>> Thanks >>> Balaji >>> >>> On May 6, 2008, at 9:50 PM, Eno wrote: >>> >>>> >>>> On Mon, 5 May 2008, Balaji Srinivasan wrote: >>>> >>>>> So I turned off session. auto_start in factories.yml. >>>>> In my preExecute method, I set up a session using session_id() >>>>> call. >>>>> >>>>> Now it looks like the flash parameters are no longer being carried >>>>> from one call to the next. Also somehow the session itself doesnt >>>>> get >>>>> restored on the next call (ie. If I add an attribute to the >>>>> session >>>>> using $this->getUser()->setAttribute(), I cannot retrieve it in >>>>> the >>>>> next call). >>>> >>>> preExecute() gets called for every action, so do you check for an >>>> existing >>>> session to use and use it or create a new one each time? >>>> >>>> Im also guessing switching off symfony's session handling means you >>>> dont >>>> get to use methods like getAttribute() and setAttribute(). Probably >>>> you'll >>>> need to write your own methods to handle storing and retrieving >>>> session >>>> data instead of using Symfony's. >>>> >>>> >>>> -- >>>> >>>> >>>> >>>>>> >>> > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "symfony developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/symfony-devs?hl=en -~----------~----~----~----~------~----~------~--~---
