BryanDavis has uploaded a new change for review.
https://gerrit.wikimedia.org/r/267637
Change subject: SessionManager: Notify AuthPlugin before calling hooks
......................................................................
SessionManager: Notify AuthPlugin before calling hooks
This avoids a race in CentralAuth:
* The user doesn't exist locally, so CA wants to create it
* Auto-creation adds the user to the database
* A hook function tries to access the session; now the user does exist
locally but isn't yet attached, so CA rejects the session.
Bug: T125283
Change-Id: I6024885e3cf9c85c527fc160577f66ff97451c98
---
M includes/session/SessionManager.php
1 file changed, 5 insertions(+), 5 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core
refs/changes/37/267637/1
diff --git a/includes/session/SessionManager.php
b/includes/session/SessionManager.php
index 0441137..2fd5d12 100644
--- a/includes/session/SessionManager.php
+++ b/includes/session/SessionManager.php
@@ -501,11 +501,7 @@
// @codeCoverageIgnoreEnd
}
- # Notify hooks (e.g. Newuserlog)
- \Hooks::run( 'AuthPluginAutoCreate', array( $user ) );
- \Hooks::run( 'LocalUserCreated', array( $user, true ) );
-
- # Notify AuthPlugin too
+ # Notify AuthPlugin
$tmpUser = $user;
$wgAuth->initUser( $tmpUser, true );
if ( $tmpUser !== $user ) {
@@ -513,6 +509,10 @@
get_class( $wgAuth ) . '::initUser() replaced
the user object' );
}
+ # Notify hooks (e.g. Newuserlog)
+ \Hooks::run( 'AuthPluginAutoCreate', array( $user ) );
+ \Hooks::run( 'LocalUserCreated', array( $user, true ) );
+
$user->saveSettings();
# Update user count
--
To view, visit https://gerrit.wikimedia.org/r/267637
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I6024885e3cf9c85c527fc160577f66ff97451c98
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: wmf/1.27.0-wmf.11
Gerrit-Owner: BryanDavis <[email protected]>
Gerrit-Reviewer: Anomie <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits