jenkins-bot has submitted this change and it was merged.

Change subject: Fix "Sessions are disabled for this entry point" in 
GoogleLogin.hooks.php
......................................................................


Fix "Sessions are disabled for this entry point" in GoogleLogin.hooks.php

GoogleLogin currently replaces Special:UserLogin depending on if the user
is logged in and if GoogleLogin should overwrite the userlogin special page.
This results in problems, if someone (e.g. another extension) calls a function
that calls the SpecialPage_initList hook from an entry point, which doesn't
have sessions (e.g. load.php). If this happens, an exception would be thrown.

To avoid this, this change checks, if the current Request is a request for
an entry point without sessions (GoogleLogin generally doesn't need to replace
the userlogin special page for requests without sessions), and if so, doesn't
check replace the userlogin special page at all (and doesn't call the user
object). This should be considered as a hack until the extension is
converted to AuthManager (see T110294), where our own special page isn't
needed anymore (hopefully) or a better approach could be implemented.

Bug: T135445
Change-Id: I909ff5e7ef105b864516c3444ebe5bee650e3818
---
M includes/GoogleLogin.hooks.php
1 file changed, 8 insertions(+), 1 deletion(-)

Approvals:
  MaxSem: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/GoogleLogin.hooks.php b/includes/GoogleLogin.hooks.php
index d060bb5..e1bb19f 100644
--- a/includes/GoogleLogin.hooks.php
+++ b/includes/GoogleLogin.hooks.php
@@ -75,7 +75,14 @@
 
                $glConfig = ConfigFactory::getDefaultInstance()->makeConfig( 
'googlelogin' );
                // Replaces the UserLogin special page if configured and user 
isn't logged in
-               if ( !$wgUser->isLoggedIn() && $glConfig->get( 
'GLReplaceMWLogin' ) ) {
+               // TODO: The check for the MW_NO_SESSION constant is an ugly 
workaround for T135445
+               // given, that the replacement of the user login special page 
isn't needed after GoogleLogin
+               // was converted to to AuthManager (and the own Special page 
isn't needed anymore). Task T110294
+               if (
+                       !defined( 'MW_NO_SESSION' ) &&
+                       !$wgUser->isLoggedIn() &&
+                       $glConfig->get( 'GLReplaceMWLogin' )
+               ) {
                        $list['Userlogin'] = 'SpecialGoogleLogin';
                }
        }

-- 
To view, visit https://gerrit.wikimedia.org/r/289070
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I909ff5e7ef105b864516c3444ebe5bee650e3818
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/GoogleLogin
Gerrit-Branch: master
Gerrit-Owner: Florianschmidtwelzow <florian.schmidt.stargatewis...@gmail.com>
Gerrit-Reviewer: MaxSem <maxsem.w...@gmail.com>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to