[wp-trac] [WordPress Trac] #23201: post-template.php calls in_array() without checking args

WordPress Trac noreply at wordpress.org
Tue Jan 15 04:10:34 UTC 2013


#23201: post-template.php calls in_array() without checking args
-----------------------------+--------------------------
 Reporter:  gcrumb           |       Type:  defect (bug)
   Status:  new              |   Priority:  normal
Milestone:  Awaiting Review  |  Component:  Template
  Version:                   |   Severity:  normal
 Keywords:  has-patch        |
-----------------------------+--------------------------
 Line 1039 of wp-includes/post-template looks like:


 {{{
 if ( in_array( $page->ID, $_current_page->ancestors ) )
 }}}

 ... but in some circumstances, $_current_page->ancestors is null, which
 results in an error being thrown. I suggest testing the variable before
 passing it:

 {{{
 if ( gettype($_current_page->ancestors) === 'array' && in_array(
 $page->ID, $_current_page->ancestors ) )
 }}}

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


More information about the wp-trac mailing list