WordPress.org

Make WordPress Core

Opened 6 weeks ago

Closed 6 weeks ago

#53113 closed defect (bug) (fixed)

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

Reported by: diddledan Owned by: davidbaumwald
Milestone: 5.8 Priority: normal
Severity: normal Version: trunk
Component: Comments Keywords: has-patch commit
Focuses: Cc:

Description

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.


6 weeks ago

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

Trac ticket: https://core.trac.wordpress.org/ticket/53113

#2 @SergeyBiryukov
6 weeks 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
6 weeks ago

Hi there!

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

https://github.com/WordPress/WordPress/blob/master/wp-includes/class-walker-comment.php#L185

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

Replace to

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

#4 @diddledan
6 weeks ago

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

#5 @davidbaumwald
6 weeks 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
6 weeks ago

Got it. Ready to commit

#7 @davidbaumwald
6 weeks 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.