Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[HttpFoundation] Always call proxied handler::destroy() in StrictSessionHandler #25731

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 10, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
[HttpFoundation] Always call proxied handler::destroy() in StrictSess…
…ionHandler
  • Loading branch information
nicolas-grekas committed Jan 9, 2018
commit e5e2d5ddd2753ef24a2fdb73d8626a58f162b213
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
class StrictSessionHandler extends AbstractSessionHandler
{
private $handler;
private $doDestroy;

public function __construct(\SessionHandlerInterface $handler)
{
Expand Down Expand Up @@ -63,11 +64,24 @@ protected function doWrite($sessionId, $data)
return $this->handler->write($sessionId, $data);
}

/**
* {@inheritdoc}
*/
public function destroy($sessionId)
{
$this->doDestroy = true;
$destroyed = parent::destroy($sessionId);

return $this->doDestroy ? $this->doDestroy($sessionId) : $destroyed;
}

/**
* {@inheritdoc}
*/
protected function doDestroy($sessionId)
{
$this->doDestroy = false;

return $this->handler->destroy($sessionId);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public function testWriteEmptyNewSession()
$handler->expects($this->once())->method('read')
->with('id')->willReturn('');
$handler->expects($this->never())->method('write');
$handler->expects($this->never())->method('destroy');
$handler->expects($this->once())->method('destroy')->willReturn(true);
$proxy = new StrictSessionHandler($handler);

$this->assertFalse($proxy->validateId('id'));
Expand Down Expand Up @@ -154,7 +154,7 @@ public function testDestroyNewSession()
$handler = $this->getMockBuilder('SessionHandlerInterface')->getMock();
$handler->expects($this->once())->method('read')
->with('id')->willReturn('');
$handler->expects($this->never())->method('destroy');
$handler->expects($this->once())->method('destroy')->willReturn(true);
$proxy = new StrictSessionHandler($handler);

$this->assertSame('', $proxy->read('id'));
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.