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

Commit

Permalink
Merge branch 'Ocramius-hotfix/session-validation-listeners-null-retur…
Browse files Browse the repository at this point in the history
…n-values' into develop

Forward port zendframework/zendframework#6147
  • Loading branch information
Mike Willbanks committed Apr 16, 2014
7 parents 5e70318 + 9b69196 + 63fdbea + 06f0e14 + cc8b469 + a949a32 + 87c335c commit a2bc035
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/SessionManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ public function isValid()
{
$validator = $this->getValidatorChain();
$responses = $validator->triggerUntil('session.validate', $this, array($this), function ($test) {
return !$test;
return false === $test;
});
if ($responses->stopped()) {
// If execution was halted, validation failed
Expand Down
16 changes: 16 additions & 0 deletions test/SessionManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ class SessionManagerTest extends \PHPUnit_Framework_TestCase

public $cookieDateFormat = 'D, d-M-y H:i:s e';

/**
* @var SessionManager
*/
protected $manager;

public function setUp()
Expand Down Expand Up @@ -535,4 +538,17 @@ public function testSessionWriteCloseStoresMetadata()
$this->assertSame($_SESSION['__ZF'], $metaData);
}

/**
* @runInSeparateProcess
*/
public function testSessionValidationDoesNotHaltOnNoopListener()
{
$validator = $this->getMock('stdClass', array('__invoke'));

$validator->expects($this->once())->method('__invoke');

$this->manager->getValidatorChain()->attach('session.validate', $validator);

$this->assertTrue($this->manager->isValid());
}
}

0 comments on commit a2bc035

Please sign in to comment.