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.
Problem/Motivation
The Workbench moderation module implements hook_entity_storage_load() this is fired during a container rebuild before the container is rebuilt because AccountProxy::id() will unnecessarily load a user to preserve the current user ID across a container rebuild.
Note that the new content_moderation module for core no longer takes this approach but the account proxy should still not fire this hook.
Proposed resolution
Don't load the user in AccountProxy::id()
Remaining tasks
User interface changes
None
API changes
None
Data model changes
None
Comment | File | Size | Author |
---|---|---|---|
#26 | 2753733-2-26.patch | 3.77 KB | alexpott |
Comments
Comment #2
alexpottComment #3
dawehnerLooks great in general I would argue!
You can get rid of the indentation by using this: https://3v4l.org/vWFKR
Comment #5
alexpott@dawehner good idea.
Comment #6
znerol CreditAttribution: znerol commentedGood idea. I'm wondering whether there is any situation where the
id
property gets out of sync?Comment #7
dawehnerWell, its just set in two locations, but sure someone could change the session entry somehow directly, couldn't they?
Comment #8
alexpottIsn't that TRUE in HEAD?
I think this patch is good to go.
Comment #9
Berdir+1, what about the protected property rename. No problem for 8.2 I think, we exclude protected there, but not sure about 8.1, where we really try to keep changes as minimal as possible?
Comment #10
alexpott@Berdir yeah I guess we can keep the property name the same and add a big comment. Seems the "nicer" thing to do if people are extending.
Comment #11
alexpottHere's a patch preserving BC.
Comment #12
alexpottComment #13
neclimdulGot it. Couldn't figure out how this worked but this explains it and why id() is special.
gugh, I hate when we have to do this...
Comment #15
alexpottThis was a DrupalCI error
Comment #16
alexpottComment #17
apadernoThere is a space before the semicolon.
For the rest, it seems fine.
Comment #18
neclimdul@kiamlaluno I think you reviewed #11not #12 where he fixed that. :)
Comment #19
apadernoYes, it seems so.
Comment #20
catchNice find.
This makes a lot of assumptions about what 8.1.9 will be - if it's a security release it won't include this patch for example.
Elsewhere we've been using "Scheduled for removal in 9.0.0, use foo instead" which is a bit simpler.
https://api.drupal.org/api/drupal/core%21tests%21Drupal%21FunctionalTest...
Also protected properties are @internal, so I think we could remove this in 8.3.x not?
Comment #22
klausiSince it is very easy to preserve backwards compatibility for the protected property in this case I think it is fine to keep it even if we consider protected properties @internal.
Fixed the @deprecated message.
Comment #23
neclimdulLooks good to me.
Comment #24
catchLet's change the deprecation message to removal in 8.4.x - it's nice to allow code to work with two branches at a time, but we shouldn't be maintaining unnecessary bc layers for the entirety of 8.x's lifetime.
Comment #25
klausiSure.
Comment #26
alexpottHere's a patch without the extra in #25
Comment #28
catchCommitted/pushed to 8.3.x, thanks!
Comment #30
Gábor HojtsyThe promise of the deprecation message committed here did not work out. We should not be removing stuff from Drupal 8, so opened #3033317: AccountProxy initialAccountId and ViewKernelTestBase will only be removed in Drupal 9.0.0, fix deprecation messages to fix the message.