ZF-10706: Call to a member function last() on a non-object in Zend/Session/SessionManager.php on line 339

Description

Zend\Session\SessionManager::isValid() throws an error as it relies on $response being an object with a method last() while it obviously can be null.

The following code provokes this the error reproducable:

$session = new \Zend\Session\Container('test'); $session->test = 42;

Comments

Fixed in ZF2 master branch.

The issue was actually with SignalSlot. Signals::emitUntil() was not returning a ResponseCollection if no handlers were present; this is now fixed. Additionally, ResponseCollection::last() would then raise an exception if the collection was empty, as you can't return a value normally. I've modified it to return null when the collection is empty.