ZF2-410: Expiration hops in Zend\Session\Container do not remove expired values

Description

If some keys are set to expire after specific hops, the keys do not expire. Sample code, from an action controller:


use Zend\Session\Container;

public function firstAction()
{
  $container = new Container('issue-test');
  $container->setExpirationHops(1);

  $container->foo = 'bar';
}

public function secondAction()
{
  $container = new Container('issue-test');
  echo $container->foo; // bar
}

public function thirdAction()
{
  $container = new Container('issue-test');
  echo $container->foo; // bar
}

Request first > second > third.

Expected behaviour: secondAction shows bar, thirdAction null Actual behaviour: secondAction shows bar, thirdAction shows bar

At this moment, there is no option to automatically expire keys, you need to manually unset them. For example, see the comment in this PR: https://github.com/bjyoungblood/zf2/…

Comments

This issue has been closed on Jira and moved to GitHub for issue tracking. To continue following the resolution of this issues, please visit: https://github.com/zendframework/zf2/issues/2505