[wp-trac] [WordPress Trac] #56539: Check if index in $args isset / ! empty before using it in Walker_Comment methods or create default $args in case if it is empty

WordPress Trac noreply at wordpress.org
Fri Sep 9 08:23:59 UTC 2022


#56539: Check if index in $args isset / ! empty before using it in Walker_Comment
methods or create default $args in case if it is empty
--------------------------+-----------------------------
 Reporter:  oglekler      |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Comments      |    Version:
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 Taking into account the comments in #53449, I suggest local fix for the
 comments walker (wp-includes/class-walker-comment.php).

 Class Walker_Comment uses some $args indexes without checking if they
 exist. And in my case, they don't exist, $args are empty array and I am
 getting notices. I will consider adding $args into the call, but they are
 commented as optional and don't suppose to be used in such way.

 Examples:

 public function start_el uses:

 {{{
 $args['short_ping']
 $args['format']
 }}}

 And
 {{{
 $args['style']
 }}}
  is used without checking that it exists in several methods - end_el,
 end_lvl, ping, comment, html5_comment, start_lvl.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/56539>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list