From: Gergő Tisza Date: Wed, 2 Mar 2016 23:36:02 +0000 (-0800) Subject: Prevent "Failed to create..." warnings when session loading fails X-Git-Tag: 1.31.0-rc.0~7746^2 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/membres/fiche.php?a=commitdiff_plain;h=664ba620e97613f79847a822ac83074402b27a2c;p=lhc%2Fweb%2Fwiklou.git Prevent "Failed to create..." warnings when session loading fails If there is an existing session for a given ID but loading it fails, there is no point in trying to create a new empty session with that ID. Just fail silently (the reason for not loading the session should be logged elsewhere), don't spam the logs and don't slow down execution by throwing and catching an exception. Change-Id: I8299872cc29c32cb245686ed0bca6b9a5902cdc1 --- diff --git a/includes/session/SessionManager.php b/includes/session/SessionManager.php index 58f995fac7..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 );