Opened 16 years ago
Closed 16 years ago
#13934 closed defect (bug) (fixed)
$current_user unfounded assumptions
| Reported by: | filosofo | Owned by: | filosofo |
|---|---|---|---|
| Priority: | normal | Milestone: | 3.0.1 |
| Component: | Users | Version: | 3.0 |
| Severity: | normal | Keywords: | has-patch |
| Cc: | Focuses: |
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.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
(In [15315]) Use get_current_user() and get_current_user_id() instead of global . Props filofo. see #13934 for trunk