Opened 12 years ago
Closed 12 years ago
#18237 closed defect (bug) (fixed)
get_role triggers a PHP notice
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 3.3 | Priority: | normal |
Severity: | minor | Version: | 3.2.1 |
Component: | Users | Keywords: | has-patch |
Focuses: | Cc: |
Description
get_role (in wp-includes/capabilities.php) incorrectly returns a null value as a reference, triggering a PHP notice "Only variable references should be returned by reference".
While this is not a terribly important problem, it is easily resolved with the patch attached (just assign the value to a variable first, then return that).
This is a more important issue for us because we develop using a custom error handler which throws ErrorExceptions on all notices. This helps to catch a range of PHP errors (e.g. typos, uninitialised variables and whatnot), but is sometimes a PITA because of things like this.
Attachments (3)
Change History (9)
#1
@
12 years ago
- Milestone changed from Awaiting Review to 3.3
Can you submit an svn diff, rather than a diff -u?
This looks good.
#3
@
12 years ago
I think making get_role() not return a reference would be a better fix, now that we're in PHP5 land.
#4
@
12 years ago
Maybe we should close this ticket as a dup of #16767 and review the reference uses in core.
get_roles patch