Opened 15 years ago
Closed 15 years ago
#18237 closed defect (bug) (fixed)
get_role triggers a PHP notice
| Reported by: | elyobo | Owned by: | ryan |
|---|---|---|---|
| Priority: | normal | Milestone: | 3.3 |
| Component: | Users | Version: | 3.2.1 |
| Severity: | minor | Keywords: | has-patch |
| Cc: | Focuses: |
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
@
15 years ago
- Milestone Awaiting Review → 3.3
Can you submit an svn diff, rather than a diff -u?
This looks good.
#3
@
15 years ago
I think making get_role() not return a reference would be a better fix, now that we're in PHP5 land.
#4
@
15 years ago
Maybe we should close this ticket as a dup of #16767 and review the reference uses in core.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
get_roles patch