Session start, destroy, start, exception issue

2 messages Options
Embed this post
Permalink
Žilvinas Šaltys

Session start, destroy, start, exception issue

Reply Threaded More More options
Print post
Permalink
Hello,

First sorry if it's not the right place to ask about this. In my
defense I tried to google about this but couldn't find any relevant
information.

In PHP it seems perfectly normal to start a session, destroy it, and
then start it again. You can do it as much as you like.

http://php.net/session_destroy

Lots of login/logout code is written like this. On logout session is
destroyed and then started again.

Zend_Session destroy() method throws an exception if:

if (self::$_sessionStarted && self::$_destroyed) {
            require_once 'Zend/Session/Exception.php';
            throw new Zend_Session_Exception('The session was
explicitly destroyed during this request, attempting to re-start is
not allowed.');
        }

To me it seems that Zend_Session _changes_ the way sessions work.

I would like to ask if there is a reason for this? Are there any
workarounds? Btw in my current situation using Zend_Auth is not a
viable option.

Thanks for any answer,
Bye!
till

Re: Session start, destroy, start, exception issue

Reply Threaded More More options
Print post
Permalink
2009/6/29 Žilvinas Šaltys <[hidden email]>:

> Hello,
>
> First sorry if it's not the right place to ask about this. In my
> defense I tried to google about this but couldn't find any relevant
> information.
>
> In PHP it seems perfectly normal to start a session, destroy it, and
> then start it again. You can do it as much as you like.
>
> http://php.net/session_destroy
>
> Lots of login/logout code is written like this. On logout session is
> destroyed and then started again.
>
> Zend_Session destroy() method throws an exception if:
>
> if (self::$_sessionStarted && self::$_destroyed) {
>            require_once 'Zend/Session/Exception.php';
>            throw new Zend_Session_Exception('The session was
> explicitly destroyed during this request, attempting to re-start is
> not allowed.');
>        }
>
> To me it seems that Zend_Session _changes_ the way sessions work.
>
> I would like to ask if there is a reason for this? Are there any
> workarounds? Btw in my current situation using Zend_Auth is not a
> viable option.
>
> Thanks for any answer,
> Bye!
>

Aside from "destroying" the session, what are you trying to do? Maybe
there's another way.

Till