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

WordPress Trac wp-trac at lists.automattic.com
Sun Apr 6 05:27:45 GMT 2008


#6608: get_posts() needs a default argument
------------------------+---------------------------------------------------
 Reporter:  karlkatzke  |       Owner:  anonymous
     Type:  defect      |      Status:  new      
 Priority:  low         |   Milestone:  2.5.1    
Component:  General     |     Version:  2.5      
 Severity:  normal      |    Keywords:           
------------------------+---------------------------------------------------
 On line 406 of wp-includes/post.php, the function get_posts is specified
 without a default argument for $args, which means that any time a user
 calls get_posts without passing arguments in, a PHP warning will be
 generated -

 {{{
 [Sun Apr 06 00:14:27 2008] [error] [client 74.192.38.89] PHP Warning:
 Missing argument 1 for get_posts(), called in
 new.karlkatzke.com/wp-content/themes/noveaukatzke/index.php on line 12 and
 defined in new.karlkatzke.com/wp-includes/post.php on line 406
 }}}

 solution: Redefine the function like `function get_posts($args = null)` as
 opposed to `function get_posts()`

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


More information about the wp-trac mailing list