Skip to content
This repository has been archived by the owner on Jan 31, 2020. It is now read-only.

Commit

Permalink
Merge branch 'hotfix/zendframework/zendframework#7127-session-manager…
Browse files Browse the repository at this point in the history
…-with-array-storage-fails-with-notice'

Close zendframework/zendframework#7127
  • Loading branch information
Ocramius committed Feb 2, 2015
2 parents adb1dc9 + 966e7d6 commit f48fdbd
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/SessionManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,10 @@ public function start($preserveStorage = false)
$this->registerSaveHandler($saveHandler);
}

$oldSessionData = $_SESSION;
$oldSessionData = array();
if (isset($_SESSION)) {
$oldSessionData = $_SESSION;
}

session_start();

Expand Down
14 changes: 14 additions & 0 deletions test/Service/SessionManagerFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,18 @@ public function testFactoryWillAddValidatorViaConfiguration()

$this->assertEquals(1, $manager->getValidatorChain()->getListeners('session.validate')->count());
}

/**
* @runInSeparateProcess
*/
public function testStartingSessionManagerFromFactoryDoesNotTriggerUndefinedVariable()
{
$storage = new ArrayStorage();
$this->services->setService('Zend\Session\Storage\StorageInterface', $storage);

$manager = $this->services->get('Zend\Session\ManagerInterface');
$manager->start();

$this->assertSame($storage, $manager->getStorage());
}
}

0 comments on commit f48fdbd

Please sign in to comment.