Make WordPress Core

Opened 3 years ago

Closed 2 years ago

#60475 closed defect (bug) (fixed)

Possible incorrect type for $comment_id in get_comment_author filter

Reported by: david.binda Owned by: SergeyBiryukov
Priority: normal Milestone: 6.6
Component: Comments Version: 6.0
Severity: normal Keywords: has-patch
Cc: Focuses:

Description

After r52818 the $comment_id param of the get_comment_author filter, which is documented as numeric string, may be an int, in case a non-existing comment ID is passed to the get_comment_author function.

The topic has been briefly discussed in https://core.trac.wordpress.org/ticket/54379#comment:8 mentioning that the numeric string type is here for compatibility.

I'm attaching a patch containing a fix for the issue, as well as a PHPUnit test demonstrating the behaviour.

Attachments (1)

60475.diff (3.3 KB ) - added by david.binda 3 years ago.

Download all attachments as: .zip

Change History (4)

@david.binda
3 years ago

#1 @Presskopp
2 years ago

  • Keywords has-patch added

#2 @SergeyBiryukov
2 years ago

  • Milestone Awaiting Review6.6

#3 @SergeyBiryukov
2 years ago

  • Owner set to SergeyBiryukov
  • Resolutionfixed
  • Status newclosed

In 58335:

Comments: Ensure the correct comment ID type is passed to get_comment_author.

The $comment_id parameter of the get_comment_author filter is documented as a numeric string, however in case a non-existing comment ID is passed to the get_comment_author() function, it could be an integer instead.

This commit resolves the issue and adds a PHPUnit test demonstrating the behavior.

Includes updating get_comment_author_url() unit tests for consistency.

Follow-up to [41127], [52818].

Props david.binda.
Fixes #60475.

Note: See TracTickets for help on using tickets.