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

Files: 
CommentFileSizeAuthor
#9 interdiff.txt2.71 KBjoelpittet
#9 2061953-9-more-global-user-auth-mananger.patch4.21 KBjoelpittet
FAILED: [[SimpleTest]]: [MySQL] Drupal installation failed.
[ View ]
#9 2061953-9-more-global-user-auth-mananger.patch4.21 KBjoelpittet
FAILED: [[SimpleTest]]: [MySQL] Drupal installation failed.
[ View ]
#3 2061953-3.patch1.36 KBanpolimus
FAILED: [[SimpleTest]]: [MySQL] 58,778 pass(es), 4 fail(s), and 0 exception(s).
[ View ]
#1 2061953-1.patch1.1 KBanpolimus
FAILED: [[SimpleTest]]: [MySQL] 57,793 pass(es), 5 fail(s), and 1 exception(s).
[ View ]

Comments

anpolimus’s picture

Issue tags:+CodeSprintCIS
StatusFileSize
new1.1 KB
FAILED: [[SimpleTest]]: [MySQL] 57,793 pass(es), 5 fail(s), and 1 exception(s).
[ View ]

Replaced global $user with $account = $request->attributes->get('_account');

Deleted $user = $account because of it is unneeded now.

anpolimus’s picture

Status:Active» Needs review

need review

anpolimus’s picture

StatusFileSize
new1.36 KB
FAILED: [[SimpleTest]]: [MySQL] 58,778 pass(es), 4 fail(s), and 0 exception(s).
[ View ]

Deleted $acount getting via services, because this data is generating in this method.

The last submitted patch, 2061953-3.patch, failed testing.

joelpittet’s picture

Status:Needs work» Needs review
Issue tags:+CodeSprintCIS

#3: 2061953-3.patch queued for re-testing.

joelpittet’s picture

+++ b/core/lib/Drupal/Core/Authentication/AuthenticationManager.php
@@ -83,10 +83,7 @@ public function applies(Request $request) {
-
-    $account = NULL;
-
+    ¶

Not 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.

joelpittet’s picture

Status:Needs review» Needs work
sidharthap’s picture

This is failing as $GLOBALS['user']->isAuthenticated() is used on MaintenanceModeSubscriber.php and test shows isAuthenticated() method is not found.

joelpittet’s picture

Assigned:anpolimus» Unassigned
Issue summary:View changes
Status:Needs work» Needs review
Issue tags:-CodeSprintCIS
Parent issue:» #2047951: [META] Remove calls to deprecated global $user and $GLOBALS['user']
StatusFileSize
new4.21 KB
FAILED: [[SimpleTest]]: [MySQL] Drupal installation failed.
[ View ]
new4.21 KB
FAILED: [[SimpleTest]]: [MySQL] Drupal installation failed.
[ View ]
new2.71 KB

@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.

The last submitted patch, 9: 2061953-9-more-global-user-auth-mananger.patch, failed testing.

The last submitted patch, 9: 2061953-9-more-global-user-auth-mananger.patch, failed testing.

joelpittet’s picture

joelpittet’s picture

The last submitted patch, 9: 2061953-9-more-global-user-auth-mananger.patch, failed testing.

The last submitted patch, 9: 2061953-9-more-global-user-auth-mananger.patch, failed testing.

The last submitted patch, 9: 2061953-9-more-global-user-auth-mananger.patch, failed testing.

Berdir’s picture

Re-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.

xjm’s picture

Status:Needs review» Postponed

Postponing on the removal everywhere else.

Berdir’s picture

Status:Postponed» Closed (duplicate)

See #2328645: Remove remaining global $user, closing as duplicate of that.