/**
* Get the global SessionManager
- * @return SessionManagerInterface
- * (really a SessionManager, but this is to make IDEs less confused)
+ * @return self
*/
public static function singleton() {
if ( self::$instance === null ) {
} else {
$store = \ObjectCache::getInstance( $this->config->get( 'SessionCacheType' ) );
}
+ $this->logger->debug( 'SessionManager using store ' . get_class( $store ) );
$this->store = $store instanceof CachedBagOStuff ? $store : new CachedBagOStuff( $store );
register_shutdown_function( [ $this, 'shutdown' ] );
"$provider returned empty session info with id flagged unsafe"
);
}
- // @phan-suppress-next-line PhanTypeInvalidDimOffset
$compare = $infos ? SessionInfo::compare( $infos[0], $info ) : -1;
if ( $compare > 0 ) {
continue;
public function getVaryHeaders() {
// @codeCoverageIgnoreStart
+ // @phan-suppress-next-line PhanUndeclaredConstant
if ( defined( 'MW_NO_SESSION' ) && MW_NO_SESSION !== 'warn' ) {
return [];
}
public function getVaryCookies() {
// @codeCoverageIgnoreStart
+ // @phan-suppress-next-line PhanUndeclaredConstant
if ( defined( 'MW_NO_SESSION' ) && MW_NO_SESSION !== 'warn' ) {
return [];
}
}
if ( count( $retInfos ) > 1 ) {
- $ex = new \OverflowException(
+ throw new SessionOverflowException(
+ $retInfos,
'Multiple sessions for this request tied for top priority: ' . implode( ', ', $retInfos )
);
- $ex->sessionInfos = $retInfos;
- throw $ex;
}
return $retInfos ? $retInfos[0] : null;
public function getSessionFromInfo( SessionInfo $info, WebRequest $request ) {
// @codeCoverageIgnoreStart
if ( defined( 'MW_NO_SESSION' ) ) {
+ // @phan-suppress-next-line PhanUndeclaredConstant
if ( MW_NO_SESSION === 'warn' ) {
// Undocumented safety case for converting existing entry points
$this->logger->error( 'Sessions are supposed to be disabled for this entry point', [