Permalink
Browse files

fix for zendframework/zendframework#3458

  • Loading branch information...
1 parent ebfb1d3 commit a1b8bf17d992fec520e5e4dfe7161e197e69d4ed @netiul netiul committed Jan 17, 2013
Showing with 13 additions and 1 deletion.
  1. +1 −1 library/Zend/Session/SessionManager.php
  2. +12 −0 tests/ZendTest/Session/SessionManagerTest.php
@@ -163,7 +163,7 @@ public function writeClose()
// object isImmutable.
$storage = $this->getStorage();
if (!$storage->isImmutable()) {
- $_SESSION = (array) $storage;
+ $_SESSION = $storage->toArray();
session_write_close();
$storage->fromArray($_SESSION);
$storage->markImmutable();
@@ -153,6 +153,18 @@ public function testStartDoesNothingWhenCalledAfterWriteCloseOperation()
$this->assertEquals($id1, $id2);
}
+ /**
+ * @runInSeparateProcess
+ */
+ public function testStorageContentIsPreservedByWriteCloseOperation()
+ {
+ $this->manager->start();
+ $storage = $this->manager->getStorage();
+ $storage['foo'] = 'bar';
+ $this->manager->writeClose();
+ $this->assertTrue(isset($storage['foo']) && $storage['foo'] == 'bar');
+ }
+
/**
* @runInSeparateProcess
*/

0 comments on commit a1b8bf1

Please sign in to comment.