Added by Ralph Schindler, last edited by Darby Felton on Apr 02, 2008  (view change)

Labels

 
(None)

Overview

Since ZF 2.0 will be upon us later 2008, now would be a good time to start discussing the pain points and potential growth ideas that might resolve around Zend_Session.  The motivation is that since ZF 2.0 represents a non-BC release, we have the opportunity to take and grow the API in a way that makes it more consistent with the rest of the framework as well as clean up the code and provide an API that is as updated as the current PHP version requirement.

Areas for Improvement

  1. Overall Component Structure
    • Should Zend_Session become a Singleton?
    • Should Zend_Session support pluggable/modular storage engines (ext/session as default)?
    • Examine how Zend_Session_Namespace can be more consistent with the Zend_Registry interface/api and visa-versa
  2. Zend_Session Component Unit Testing
    • Need better test coverage
    • Need better mechanism for request simulation (currently using exec, perhaps runkit would be better?) We should talk to Sebastien on this one
  3. Zend_Session Consumer Unit Testing
    • FlashMessenger should be able to use whatever mechanism is used by Zend_Session for unit testing
  4. Zend_Session will not work with PHP 5.2.0, perhaps ZF can raise requirements
  5. Documentation overhaul with any changes implemented

Open JIRA Issues

Zend Framework Issue Tracker (24 issues)
Key T Pr Summary Created Updated
ZF-4305 Improvement Minor Zend_Session should allow me to use HTTP-only Cookies Sep 16, 2008 Oct 06, 2008
ZF-4077 Bug Major Zend_Session_SaveHandler_DbTable Error when using Oracle Aug 26, 2008 Aug 26, 2008
ZF-4075 New Feature Minor Zend_Session_SaveHandler_DbTable should be able to map session vars to specific fields in db Aug 26, 2008 Aug 26, 2008
ZF-3788 Unit Tests: Problem Major testSessionSaving(Zend_Session_SaveHandler_DbTableTest) unit tests error Jul 29, 2008 Sep 15, 2008
ZF-3744 Bug Major Zend_Session_SaveHandler_DbTable throwing errors in version 1.6 RC1 Jul 24, 2008 Sep 15, 2008
ZF-3593 Bug Minor Zend_Session::expireSessionCookie fails on initial session creation Jul 07, 2008 Sep 15, 2008
ZF-3378 Bug Major Zend_Session allow invalid session ids Jun 04, 2008 Sep 03, 2008
ZF-3364 Bug Major Zend_Session setOptions() doesn't support cookie_httponly Jun 02, 2008 Oct 06, 2008
ZF-3324 Bug Minor remember_me_seconds in ini file does not change cookie lifetime May 25, 2008 Sep 15, 2008
ZF-3308 Improvement Minor exception when Zend_Auth::getInstance()->setStorage(new My_Auth_Storage_CustomStorage()); is called more than one time May 22, 2008 Sep 03, 2008
ZF-3214 New Feature Major Zend_Session / Zend_Session_Namespace expire / timeout due to idling May 07, 2008 Jul 21, 2008
ZF-3209 Improvement Minor Zend_Session::_processStartupMetadataGlobal() never unsets $_SESSION['__ZF'][$namespace]['ENVGH'] May 06, 2008 Sep 03, 2008
ZF-3127 Bug Major constructor should be protected to get it working with php 5.2.6 Apr 17, 2008 Sep 03, 2008
ZF-3020 Bug Minor Zend_Session error handler handles anything in E_ALL as an exception Apr 02, 2008 Sep 03, 2008
ZF-2884 Bug Major Zend_Session errors if PHP magic quotes are turned on in a *nix environment Mar 14, 2008 Sep 15, 2008
ZF-2866 Improvement Trivial Zend_Session package full of hardcoded variables that should be constants Mar 12, 2008 Jul 21, 2008
ZF-2608 Improvement Minor Add method to retrieve the complete session content Feb 09, 2008 Apr 22, 2008
ZF-2103 Improvement Major Zend_Session_Namespace - Optional argument to create namespace in deeper nodes Oct 26, 2007 Sep 03, 2008
ZF-2083 Bug Minor Can't register session validator before session is started Oct 17, 2007 Sep 03, 2008
ZF-2077 Improvement Minor Zend_Session_Namespace allows invalid namespaces Oct 16, 2007 Apr 22, 2008
ZF-2060 Bug Minor missing method Zend_Session::getOption / getOptions Oct 12, 2007 Sep 03, 2008
ZF-1982 New Feature Minor Zend_Session_Namespace should have a getter for the $_namespace property Sep 21, 2007 Apr 22, 2008
ZF-1720 Bug Major Zend_Session setId doesn't work right from PHP CLI Jul 13, 2007 Apr 22, 2008
ZF-1673 Unit Tests: Improvement Major Improve unit test code coverage Jul 02, 2007 Apr 22, 2008

I know it's not exactly aligned with the above possible improvements, but the Zend_Session documentation could use some attention, as it's not the clearest documentation in our manual.

Hi,

I already added a similar comment to the session proposal but after the review period had finished. So I will repeat it here.
In my opinion we should not completely differentiate between a session and a registry. They both do the same in general. They simply store objects that can be accesses via a key.
So in my opinion we should create an interface that a session class as well as a registry class must implement.
Instead of thinking of different objects we should think of different scopes.

a) request scope: at the moment this scope is covered by Zend_Registry
b) session scope: this scope is covered by Zend_Session
c) "registry" scope: I think of the windows registry, where data can be stored durably

for the registry scope we could also introduce adapters that store data in the filesystem(standard) or in a database. But I think we already have this with session, haven't we?

But the most important thing is that these objects stay interchangable, because they really have the same function and they of course should be accessed the same way. At the moment I don't like the session and registry objects being accessed in different ways.

I also want to address a second issue just as a basis for discussion.
We could think about the observer pattern being implemented with the above mentioned objects. This could enable different objects being registered with a session or registry object and getting informed whenever the state of those objects change.

Posted by Davisi at Feb 29, 2008 09:24

the same in general. They simply store objects that can be accesses via a key.
So in my opinion we should create an interface that a session class as well as a registry class must implement.

Currently, both Zend_Session_Namespace and Zend_Registry mimic php's stdObject and/or ArrayObject.

I am interested in what other use cases are beyond what they currently do.

Instead of thinking of different objects we should think of different scopes.

a) request scope: at the moment this scope is covered by Zend_Registry
b) session scope: this scope is covered by Zend_Session
c) "registry" scope: I think of the windows registry, where data can be stored durably

Aside from the interchangable interface, these object represent different costs to the application. Sessions are generally more expensive (due to serialization and deserialization, than do Registry objects, which are memory only).

for the registry scope we could also introduce adapters that store data in the filesystem(standard) or in a database. But I think we already have this with session, haven't we?

The registry is for a any one request to be able to store things in a "safe scope". Essentially, what Zend_Registry does for php applications, is provide a safe, namespaced, non-global space, place to store data.

I think that persisting data outside of Zend_Registry is outside the scope of Zend_Registry. But again, if a compelling use case can be demonstrated, perhaps its an avenue worth exploring.

But the most important thing is that these objects stay interchangable, because they really have the same function and they of course should be accessed the same way. At the moment I don't like the session and registry objects being accessed in different ways.

Please explain, I am unsure how the interfaces are that different at current.

I also want to address a second issue just as a basis for discussion.
We could think about the observer pattern being implemented with the above mentioned objects. This could enable different objects being registered with a session or registry object and getting informed whenever the state of those objects change.

This is interesting. I will have to do more homework on what it means to be an observer/notifier in PHP. Generally speaking, the nature of php (build up - tear down) has been (historically) a good reason to not have observers in the same sense that you see them in Java.