private $usePhpSessionHandling = true;
private $checkPHPSessionRecursionGuard = false;
+ private $shutdown = false;
+
/**
* @param SessionId $id Session ID object
* @param SessionInfo $info Session info to populate from
*/
public function deregisterSession( $index ) {
unset( $this->requests[$index] );
- if ( !count( $this->requests ) ) {
+ if ( !$this->shutdown && !count( $this->requests ) ) {
$this->save( true );
$this->provider->getManager()->deregisterSessionBackend( $this );
}
}
+ /**
+ * Shut down a session
+ * @private For use by \MediaWiki\Session\SessionManager::shutdown() only
+ */
+ public function shutdown() {
+ $this->save( true );
+ $this->shutdown = true;
+ }
+
/**
* Returns the session ID.
* @return string
$manager = \TestingAccessWrapper::newFromObject( $this->getManager() );
$manager->setLogger( new \Psr\Log\NullLogger() );
- $mock = $this->getMock( 'stdClass', [ 'save' ] );
- $mock->expects( $this->once() )->method( 'save' );
+ $mock = $this->getMock( 'stdClass', [ 'shutdown' ] );
+ $mock->expects( $this->once() )->method( 'shutdown' );
$manager->allSessionBackends = [ $mock ];
$manager->shutdown();