[wp-trac] [WordPress Trac] #14046: WP_User constructor not working as expected if called with 2 args or its phpdoc is not clear

WordPress Trac wp-trac at lists.automattic.com
Tue Jun 22 17:36:36 UTC 2010


#14046: WP_User constructor not working as expected if called with 2 args or its
phpdoc is not clear
-----------------------------+----------------------------------------------
 Reporter:  francescolaffi   |       Owner:                        
     Type:  defect (bug)     |      Status:  new                   
 Priority:  normal           |   Milestone:  Unassigned            
Component:  Role/Capability  |     Version:  3.0                   
 Severity:  normal           |    Keywords:  dev-feedback has-patch
-----------------------------+----------------------------------------------

Comment(by hakre):

 Replying to [comment:1 francescolaffi]:
 > Sorry for wrong formatting, here is the example in the second paragraph
 with correct line ends: ...

 Informative: the two (last) lines in your examples

 {{{
 new WP_User(null,'foobar') doesn't work
 new WP_User(false,'foobar') doesn't work
 }}}

 which are tagged as "doesn't work" are not to be expected to work
 according to the parameters documentation:
 {{{ * @param int|string $id User's ID or username}}}

 So passing array(), null, false, Exception() or whatever into there is not
 to be expected to work, right? (not that it isn't always valuable to
 properly sanitize a functions input, especially as this is related to user
 management).

 ----

 Then you wrote

 {{{new WP_User(0,'foobar') works}}}

 what does this works mean? Is the user object  with the userid 0 returned
 or the user of which is name is ''foobar''?

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/14046#comment:3>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list