Zend_Auth and Zend_Session

Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.

Moderator: General Moderators

Post Reply
scaraffe
Forum Newbie
Posts: 3
Joined: Fri Jan 16, 2009 1:06 pm

Zend_Auth and Zend_Session

Post by scaraffe »

I had a question regarding implementing a login/logout functionality. Is it enough if i just use Zend_Auth or is it necessary to use Zend_Session too? cos i read somewer that Zend_Auth creates sessions internally. so will that create a problem having two diffrent sessions?
User avatar
Eran
DevNet Master
Posts: 3549
Joined: Fri Jan 18, 2008 12:36 am
Location: Israel, ME

Re: Zend_Auth and Zend_Session

Post by Eran »

Regardless of how you spin it, a user only has one session. Zend_Session uses namespacing (ie, meaningful array indexes in this case) to prevent conflicts in the session and data overwrites. If you do not manually set the session for Zend_Auth (or any other auth adapter), it will use the default - which should be good enough, unless you have several sites who use the same default on the same server, in which case there might be conflicts (the same identity available on several sites).

In usually set the session namespace manually to prevent such conflicts from occurring.
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Re: Zend_Auth and Zend_Session

Post by josh »

scaraffe wrote: will that create a problem having two diffrent sessions?
No, zend_session just wraps the existing superglobal. You could run into some headaches if you're not careful but you should be able to get the 2 solutions to interoperate.
Post Reply