[wp-trac] [WordPress Trac] #23272: Notice on class-wp-walker.php

WordPress Trac noreply at wordpress.org
Wed Jan 23 14:12:48 UTC 2013


#23272: Notice on class-wp-walker.php
-----------------------------+------------------------------
 Reporter:  rodrigosprimo    |       Type:  defect (bug)
   Status:  new              |   Priority:  normal
Milestone:  Awaiting Review  |  Component:  Warnings/Notices
  Version:  trunk            |   Severity:  normal
 Keywords:                   |
-----------------------------+------------------------------
 When using the Walker class I get the following notice:

 Notice: Undefined offset: 0 in wp-includes/class-wp-walker.php on line 126

 {{{
 //display this element
 if ( is_array( $args[0] ) )
     $args[0]['has_children'] = ! empty(
 $children_elements[$element->$id_field] );
 }}}

 If I'm not mistaken, this problem is happening because the code assumes
 that the $args variable is always a non empty array which is not the case.

 I'm attaching the code I used to reproduce the problem and a patch to fix
 it.

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


More information about the wp-trac mailing list