[Solar-talk] session_start in Solar.php

Paul M Jones pmjones at solarphp.com
Fri May 26 05:38:09 PDT 2006


On May 26, 2006, at 5:29 AM, Antti Holvikari wrote:

> I'm doing some shell scripting with Solar and obviously I don't want
> session_start to be in Solar::start(). I suppose it's for the
> setFlashes().

It is in fact for setFlash(), but I'm considering moving those to  
their own class.

In the mean time ...


> Is there any way this could be handled without session_start being  
> there?

Yes; usually, I figure you always need a session, one way or  
another.  But you're right, the CLI environment has different needs.

Edit Solar.php at about line 226 and change from this ...

         // start the session if one hasn't been started already
         if (session_id() === '') {
             session_start();
         }

... to this:

         // start the session if one hasn't been started already,
         // and if we're not in the command-line environment.
         if (PHP_SAPI != 'cli' && session_id() === '') {
             session_start();
         }

Flashes will probably not work in that case, though.

Let me know if that helps.


--

Paul M. Jones  <http://paul-m-jones.com>

Solar: Simple Object Library and Application Repository
for PHP5.   <http://solarphp.com>

Savant: The simple, elegant, and powerful solution for
templates in PHP.   <http://phpsavant.com>




More information about the solar-talk mailing list