Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Part of #2047951: [META] Remove calls to deprecated global $user and $GLOBALS['user']
All places in core/lib/Drupal/Core/Authentication/AuthenticationManager.php should be fixed
Comment | File | Size | Author |
---|---|---|---|
#9 | interdiff.txt | 2.71 KB | joelpittet |
#9 | 2061953-9-more-global-user-auth-mananger.patch | 4.21 KB | joelpittet |
#9 | 2061953-9-more-global-user-auth-mananger.patch | 4.21 KB | joelpittet |
#3 | 2061953-3.patch | 1.36 KB | anpolimus |
#1 | 2061953-1.patch | 1.1 KB | anpolimus |
Comments
Comment #1
anpolimusReplaced global $user with $account = $request->attributes->get('_account');
Deleted $user = $account because of it is unneeded now.
Comment #2
anpolimusneed review
Comment #3
anpolimusDeleted $acount getting via services, because this data is generating in this method.
Comment #5
joelpittet#3: 2061953-3.patch queued for re-testing.
Comment #6
joelpittetNot sure you needed to remove the $account = NULL; line and you have some trailing whitespace in the patch.
Other than that everything looks pretty good.
Comment #7
joelpittetComment #8
sidharthapThis is failing as $GLOBALS['user']->isAuthenticated() is used on MaintenanceModeSubscriber.php and test shows isAuthenticated() method is not found.
Comment #9
joelpittet@sidharthap I don't see that there anymore, but I tried my hand at getting other auth related global users within this area of core. First patch is just more or less a re-roll and the second does a bit more.
Comment #12
joelpittet9: 2061953-9-more-global-user-auth-mananger.patch queued for re-testing.
Comment #13
joelpittet9: 2061953-9-more-global-user-auth-mananger.patch queued for re-testing.
Comment #17
BerdirRe-testing won't help, this can not work. This is the code that actually sets the global user (although it's happening in session.inc too), so obviously no other code must be left that uses global user before this can happen.
Comment #18
xjmPostponing on the removal everywhere else.
Comment #19
BerdirSee #2328645: Remove remaining global $user, closing as duplicate of that.