Make WordPress Core

Opened 3 years ago

Closed 3 years ago

#53113 closed defect (bug) (fixed)

class-walker-comment.php has call to remove_filter with incorrect number of arguments

Reported by: diddledani's profile diddledani Owned by: davidbaumwald's profile davidbaumwald
Milestone: 5.8 Priority: normal
Severity: normal Version: 5.8
Component: Comments Keywords: has-patch commit
Focuses: Cc:


Line 203:

remove_filter( 'comment_text', array( $this, 'filter_comment_text' ), 40, 2 );

Should be:

remove_filter( 'comment_text', array( $this, 'filter_comment_text' ), 40 );

(github PR will be attached)

Change History (7)

This ticket was mentioned in PR #1213 on WordPress/wordpress-develop by diddledan.

3 years ago

Nit: remove_filter takes 3 parameters with 4 given. This might cause a PHP Warning message.

Trac ticket:

#2 @SergeyBiryukov
3 years ago

  • Component changed from General to Comments
  • Keywords commit added
  • Milestone changed from Awaiting Review to 5.8
  • Owner set to davidbaumwald
  • Status changed from new to reviewing

Good catch! Introduced in [47887].

#3 @mukesh27
3 years ago

Hi there!

Can you please update PR and do the below change also?

add_filter( 'comment_text', array( $this, 'filter_comment_text' ), 40, 2 );

Replace to

add_filter( 'comment_text', array( $this, 'filter_comment_text' ), 40 );

#4 @diddledani
3 years ago

@mukesh27 that add_filter call looks correct to me. Why do you think we need to drop the priority?

#5 @davidbaumwald
3 years ago

As @diddledan mentions, I think the add_filter is correct, as it's passing 2 params to filter_comment_text. This ticket deals with removing a filter, which doesn't care about the param count.

#6 @mukesh27
3 years ago

Got it. Ready to commit

#7 @davidbaumwald
3 years ago

  • Resolution set to fixed
  • Status changed from reviewing to closed

In 50816:

Comments: Remove fourth parameter on remove_filter call.

In class-walker-comment.php, a remove_filter call on comment_text passed a fourth parameter which was not needed. This change removes the extra argument.

Props diddledan, SergeyBiryukov.
Fixes #53113.

Note: See TracTickets for help on using tickets.