[wp-trac] Re: [WordPress Trac] #6608: get_posts() needs a default argument

WordPress Trac wp-trac at lists.automattic.com
Wed Apr 9 23:35:36 GMT 2008


#6608: get_posts() needs a default argument
-------------------------+--------------------------------------------------
 Reporter:  karlkatzke   |        Owner:  anonymous
     Type:  enhancement  |       Status:  new      
 Priority:  low          |    Milestone:  2.5.1    
Component:  General      |      Version:  2.5      
 Severity:  normal       |   Resolution:           
 Keywords:  has-patch    |  
-------------------------+--------------------------------------------------
Comment (by karlkatzke):

 My point about marking it as a defect:

 When you provide no parameters, it will use the defaults already set in
 the function and then throws a warning.

 When you provide some parameters, it works as expected.

 When you provide a parameter of null, it uses the defaults already set in
 the function and does not throw an warning.

 Therefore, since it throws a warning/error in it's current state (and
 hence is a bug) when you use the defaults, it was to me a defect since
 code should never throw warnings/errors when working properly.

 Pedantic, I know. But pedantry is the father of all good code.

 Thanks for the patch! Although I would like to note that to bring it into
 line with the *rest* of wp code it should be `$args = ''` ... which I
 didn't notice until I was making sure that we got all of them.

-- 
Ticket URL: <http://trac.wordpress.org/ticket/6608#comment:6>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list