Closed (outdated)
Project:
Drupal core
Version:
7.x-dev
Component:
base system
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
18 Nov 2010 at 23:28 UTC
Updated:
29 Mar 2015 at 05:34 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
dave reidAlso fixes some use where we try to pass in $node, which is just wrong, wrong, wrong.
Comment #2
dave reidFound more.
Comment #3
BenK commentedSubscribing
Comment #4
moshe weitzman commentedI suppose contrib supposed to start loading current user all over the place too? This is ugly. Not sure how to proceed. I wanted #361471-12: Global $user object should be a complete entity
Comment #5
joachim commentedEither way, isn't this going to make showing pages like /node and /blog a fair bit more expensive?
I do agree that passing the $node is very wrong!
Comment #6
dries commentedI don't think this is the proper solution. If we want to do this, we should do it differently IMO. That or the Realname module should do a user_load().
Comment #7
dave reidExcept the problem is realname doesn't know *when* it should have to do user_load(). If you can answer me that with code, then I'm fine with this. But we still shouldn't be passing in $node objects to format_username(). That's just wrong.
Comment #8
dave reidWow, this also fixes potential XSS because format_username should not be used with !placeholders in t(). It's supposed to be check_plain()'d.
Comment #9
dave reidAnother reason why its better to fix it this way rather than "let contrib deal with core's bugs" is because since $account is an object and by default PHP objects are passed by reference, if a modules does $account = user_load($account->uid); in hook_format_username_alter(), it's now overwritten what is really the $node object that's passed in before the patch above is applied.
Comment #10
mgiffordPatch no longer applies.