Opened 15 years ago
Closed 15 years ago
#13934 closed defect (bug) (fixed)
$current_user unfounded assumptions
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 3.0.1 | Priority: | normal |
Severity: | normal | Version: | 3.0 |
Component: | Users | Keywords: | has-patch |
Focuses: | Cc: |
Description
Currently, a number of places in the code (mainly in MS areas) assume that $current_user
is a defined global object, when in fact that's not a safe assumption to make.
For most of the cases, $current_user
is brought into scope just to get the current user's ID; in that case get_current_user_id()
is much more reliable.
For the others, $current_user
should be explicitly defined to make sure that
- If it has not been instantiated, it now will be.
- The pluggable functions get to instantiate it, if applicable.
Patch calls get_current_user_id()
when that's what's desired; in the other instances it makes sure that it is defined appropriately.
Attachments (1)
Note: See
TracTickets for help on using
tickets.
(In [15315]) Use get_current_user() and get_current_user_id() instead of global . Props filofo. see #13934 for trunk