Provide default $_SESSION array superglobal proxy storage adapter #3404

merged 6 commits into from Jan 11, 2013


None yet

3 participants



The Session Storage classes currently replace the $_SESSION superglobal with an ArrayObject. This is fine and dandy until you need to incorporate third party libraries. This is due to a bug in PHP which does not allow offsetGet to return a reference (ArrayObject only). This causes an error when attempting to unset a multi-dimensional array.

This new storage adapter will be the default and will have a slight break in BC. The new storage adapter implements ArrayAccess and proxies to the $_SESSION container. The BC break only happens when manipulating the storage object directly; however, this is generally more limited to a type cast such as: $array = (array) $session->storage; as it has been implemented with ArrayAccess and utilizing magic methods to incorporate much of the prior behavior.

Utilizing the Previous Storage:

$sessionManager = new SessionManager(
    new Zend\Session\Config\SessionConfig(),
    new Zend\Session\Storage\SessionStorage()

Please review discussion from issue #3379.

Re-issued due to the need to PR to the develop branch rather than master.

@weierophinney weierophinney added a commit that referenced this pull request Jan 11, 2013
@weierophinney weierophinney [#3404] Better description of change
- Detailed the reason for the change, provided code samples of affected an
  unaffected code, and expanded descriptions.
@weierophinney weierophinney merged commit 1a086bd into zendframework:develop Jan 11, 2013

1 check failed

default The Travis build failed
@cgmartin cgmartin pushed a commit to cgmartin/zf2 that referenced this pull request Jan 12, 2013
@weierophinney weierophinney Merge branch 'feature/3404' into develop
Close #3404
@weierophinney weierophinney added a commit to zendframework/zend-session that referenced this pull request May 15, 2015
@weierophinney weierophinney Merge branch 'feature/3404' into develop 0d2be7b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment