Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Resolved Issue: #3748 - offsetGet and __get should do a direct proxy to $_SESSION #3793

Closed
wants to merge 2 commits into from

2 participants

Mike Willbanks Matthew Weier O'Phinney
Mike Willbanks
Collaborator

Basically; this fixes an oversight on my part here; it should have returned a null reference to begin with but the actual intended behavior with $_SESSION is slightly different and actually works best by doing a direct proxy.

Matthew Weier O'Phinney weierophinney closed this pull request from a commit
Matthew Weier O'Phinney weierophinney Merge branch 'hotfix/3793'
Close #3793
Fixes #3748
06ba23f
Deleted user Unknown referenced this pull request from a commit
Matthew Weier O'Phinney weierophinney Merge branch 'hotfix/3793'
Close #3793
Fixes #3748
e9ca014
Deleted user Unknown referenced this pull request from a commit
Matthew Weier O'Phinney weierophinney Merge branch 'hotfix/3793' into develop
Forward port #3793
f5eede7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
12 library/Zend/Session/Storage/SessionArrayStorage.php
View
@@ -22,11 +22,7 @@ class SessionArrayStorage extends AbstractSessionArrayStorage
*/
public function &__get($key)
{
- if (isset($_SESSION[$key])) {
- return $_SESSION[$key];
- }
-
- return null;
+ return $_SESSION[$key];
}
/**
@@ -37,10 +33,6 @@ public function &__get($key)
*/
public function &offsetGet($key)
{
- if (isset($_SESSION[$key])) {
- return $_SESSION[$key];
- }
-
- return null;
+ return $_SESSION[$key];
}
}
21 tests/ZendTest/Session/SessionArrayStorageTest.php
View
@@ -145,4 +145,25 @@ public function testToArrayWithMetaData()
$this->assertSame($expected, $this->storage->toArray(true));
}
+ public function testUndefinedSessionManipulation()
+ {
+ if (version_compare(PHP_VERSION, '5.3.4') < 0) {
+ $this->markTestSkipped('Known issue on versions of PHP less than 5.3.4');
+ }
+
+ $this->storage['foo'] = 'bar';
+ $this->storage['bar'][] = 'bar';
+ $this->storage['baz']['foo'] = 'bar';
+
+ $expected = array(
+ '__ZF' => array(
+ '_REQUEST_ACCESS_TIME' => $this->storage->getRequestAccessTime(),
+ ),
+ 'foo' => 'bar',
+ 'bar' => array('bar'),
+ 'baz' => array('foo' => 'bar'),
+ );
+ $this->assertSame($expected, $this->storage->toArray(true));
+ }
+
}
Something went wrong with that request. Please try again.