Permalink
Browse files

Resolved Issue: #3748 - offsetGet and __get should do a direct proxy …

…to $_SESSION
  • Loading branch information...
1 parent 4fe0377 commit 639372e2103c26d10598863e5fd590c07e6d8b04 @mwillbanks committed Feb 15, 2013
@@ -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];
}
}
@@ -145,4 +145,21 @@ public function testToArrayWithMetaData()
$this->assertSame($expected, $this->storage->toArray(true));
}
+ public function testUndefinedSessionManipulation()
+ {
+ $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));
+ }
+
}

0 comments on commit 639372e

Please sign in to comment.