Closed (duplicate)
Project:
Drupal core
Version:
8.0.x-dev
Component:
base system
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
10 Aug 2013 at 10:42 UTC
Updated:
14 Feb 2015 at 18:07 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
dstorozhukRemoved calls to deprecated global $user in core/includes/bootstrap.inc
in 3 functions:
Comment #2
dstorozhukComment #4
sergeypavlenko commentedIssue #2062151: Create a current user service to ensure that current account is always available Fix.
Comment #6
sergeypavlenko commented#4: drupal8.base-system.2062069-4.patch queued for re-testing.
Comment #8
blainelang commentedUpdated patch to use: $user = Drupal::request()->attributes->get('_account');
Comment #9
blainelang commentedComment #11
m1r1k commentedRe-roll
Comment #12
m1r1k commentedPush for testing
Comment #14
m1r1k commentedLets, try with removing request scope adding this patch #2076411: Remove the request scope from the current user service
Comment #15
m1r1k commentedComment #17
joelpittetSame as #14 but without the scope bit which was done elsewhere(temporarily)
Comment #19
joelpittet#17: bootstrap-remove-global-user-from-bootstrap-inc-2062069-17.patch queued for re-testing.
Comment #21
cosmicdreams commentedThis patch makes just one change. Let's see if it breaks the install.
Comment #23
joelpittetHere's the error on the patch above #21:
Comment #24
dawehnerLet's have a look at this piece of code. $user is not required to let this be run. I think this behavior is intended as the installer
or other really early bootstrap code don't have a user yet. In order to use a service you can use \Drupal::getContainer()->get('current_user', \Symfony\Component\DependencyInjection\ContainerInterface::IGNORE_ON_INVALID_REFERENCE); which will not throw an exception.
Comment #25
joelpittetSeems to be still failing locally with the same error, but thanks for giving more hints @dawehner
Comment #27
tim.plunkettComment #28
dawehnerOh right, this is indeed way simpler.
Comment #29
joelpittetStill not working locally, so I expect the same results.
Comment #30
joelpittet.
Comment #32
berdirYeah, well.
Unfortunately, our oh so great pluggable authentication system is a lie. Or to be specific, the Cookie authentication provider is a lie.
It simply calls drupal_session_initialize(), that then directly populates global $user and only global $user and directly calls date_default_timezone_set(drupal_get_user_timezone()); Obviously, in there, the user service is never going to be set.
What needs to happen is that this function is moved to the authentication manager, after we are able to populate the user service. But moving that will probably not work, because the reason the cookie stuff works like this is that this code is still shared with the installer/update/authenticate stuff.
Something needs to happen to session.inc. Something that involves fire. But #1858196: [meta] Leverage Symfony Session components isn't working either so far :(
Comment #33
cosmicdreams commentedI would love to knock the session issue out but need help. The frustrating thing is that I was hoping this issue would help as I'm trying to remove the use of the global user there to.
Regardless, I feel we are dramatically close to a solution with the session patch. Please help.
Comment #34
ianthomas_uk29: 2062069-29-global-user-bootstrap-simple.patch queued for re-testing.
Comment #36
ianthomas_ukPostponed on #1858196: [meta] Leverage Symfony Session components
Comment #39
chr.fritschComment #41
berdirSee #2328645: Remove remaining global $user, closing as duplicate of that.