X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fsession%2FSessionManager.php;h=81f82439e2f49604e2688c7724f6bd82c836d8c3;hb=664ba620e97613f79847a822ac83074402b27a2c;hp=1aab12a89512a06a0255cae6b505fdc0c128db77;hpb=96906168cac0e9a7748511b48c369cf22c8406d5;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/session/SessionManager.php b/includes/session/SessionManager.php index 1aab12a895..81f82439e2 100644 --- a/includes/session/SessionManager.php +++ b/includes/session/SessionManager.php @@ -202,6 +202,7 @@ final class SessionManager implements SessionManagerInterface { // of "no such ID" $key = wfMemcKey( 'MWSession', $id ); if ( is_array( $this->store->get( $key ) ) ) { + $create = false; $info = new SessionInfo( SessionInfo::MIN_PRIORITY, [ 'id' => $id, 'idIsSafe' => true ] ); if ( $this->loadSessionInfoFromStore( $info, $request ) ) { $session = $this->getSessionFromInfo( $info, $request ); @@ -296,6 +297,11 @@ final class SessionManager implements SessionManagerInterface { } public function getVaryHeaders() { + // @codeCoverageIgnoreStart + if ( defined( 'MW_NO_SESSION' ) && MW_NO_SESSION !== 'warn' ) { + return []; + } + // @codeCoverageIgnoreEnd if ( $this->varyHeaders === null ) { $headers = []; foreach ( $this->getProviders() as $provider ) { @@ -314,6 +320,11 @@ final class SessionManager implements SessionManagerInterface { } public function getVaryCookies() { + // @codeCoverageIgnoreStart + if ( defined( 'MW_NO_SESSION' ) && MW_NO_SESSION !== 'warn' ) { + return []; + } + // @codeCoverageIgnoreEnd if ( $this->varyCookies === null ) { $cookies = []; foreach ( $this->getProviders() as $provider ) { @@ -507,12 +518,14 @@ final class SessionManager implements SessionManagerInterface { } # Notify AuthPlugin + // @codeCoverageIgnoreStart $tmpUser = $user; $wgAuth->initUser( $tmpUser, true ); if ( $tmpUser !== $user ) { $logger->warning( __METHOD__ . ': ' . get_class( $wgAuth ) . '::initUser() replaced the user object' ); } + // @codeCoverageIgnoreEnd # Notify hooks (e.g. Newuserlog) \Hooks::run( 'AuthPluginAutoCreate', [ $user ] ); @@ -651,8 +664,14 @@ final class SessionManager implements SessionManagerInterface { // This is going to error out below, but we want to // provide a complete list. $retInfos[] = $info; + } else { + // Session load failed, so unpersist it from this request + $info->getProvider()->unpersistSession( $request ); } } + } else { + // Session load failed, so unpersist it from this request + $info->getProvider()->unpersistSession( $request ); } } @@ -951,6 +970,7 @@ final class SessionManager implements SessionManagerInterface { * @return Session */ public function getSessionFromInfo( SessionInfo $info, WebRequest $request ) { + // @codeCoverageIgnoreStart if ( defined( 'MW_NO_SESSION' ) ) { if ( MW_NO_SESSION === 'warn' ) { // Undocumented safety case for converting existing entry points @@ -959,6 +979,7 @@ final class SessionManager implements SessionManagerInterface { throw new \BadMethodCallException( 'Sessions are disabled for this entry point' ); } } + // @codeCoverageIgnoreEnd $id = $info->getId();