Merge "mw.Upload.BookletLayout: Don't explode when the API call fails with 'exception'"
[lhc/web/wiklou.git] / includes / context / RequestContext.php
index 16f11ee..afb5704 100644 (file)
@@ -576,8 +576,9 @@ class RequestContext implements IContextSource, MutableContext {
                        // Get new session, if applicable
                        $session = null;
                        if ( strlen( $params['sessionId'] ) ) { // don't make a new random ID
-                               $session = MediaWiki\Session\SessionManager::singleton()
-                                       ->getSessionById( $params['sessionId'] );
+                               $manager = MediaWiki\Session\SessionManager::singleton();
+                               $session = $manager->getSessionById( $params['sessionId'], true )
+                                       ?: $manager->getEmptySession();
                        }
 
                        // Remove any user IP or agent information, and attach the request