Opened 6 years ago
Last modified 6 years ago
#45498 reviewing defect (bug)
Wrong order of arguments in call_user_func() for Walker_Comment::start_el()
Reported by: | milana_cap | Owned by: | SergeyBiryukov |
---|---|---|---|
Milestone: | Future Release | Priority: | normal |
Severity: | normal | Version: | |
Component: | Comments | Keywords: | has-patch needs-unit-tests |
Focuses: | Cc: |
Description
Arguments order for rendering all types of comments is $comment, $depth, $args
except for the custom callback:
call_user_func( $args['callback'], $comment, $args, $depth );
This causes every custom callback to throw an error when you use $args
and $depth
as you'd expect.
For example, comment_reply_link()
inside callback can not be used like it's suppose to be used, like so:
<?php comment_reply_link( array_merge( $args, array( 'add_below' => 'div-comment', 'depth' => $depth, 'max_depth' => $args['max_depth'], 'before' => '<div class="reply">', 'after' => '</div>' ) ) );
You need to replace $depth
and $args
, like so:
<?php comment_reply_link( array_merge( $depth, array( 'add_below' => 'div-comment', 'depth' => $args, 'max_depth' => $depth['max_depth'], 'before' => '<div class="reply">', 'after' => '</div>' ) ) );
Attachments (1)
Change History (3)
Note: See
TracTickets for help on using
tickets.
Patch needs review, particularly with consideration to if it's likely to break workarounds for this bug.
Unit tests would also be good.