[wp-trac] [WordPress Trac] #18237: get_role triggers a PHP notice

WordPress Trac wp-trac at lists.automattic.com
Mon Jul 25 05:56:45 UTC 2011


#18237: get_role triggers a PHP notice
--------------------------+-----------------------------
 Reporter:  elyobo        |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Users         |    Version:  3.2.1
 Severity:  minor         |   Keywords:  has-patch
--------------------------+-----------------------------
 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.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/18237>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list