WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 3 years ago

Last modified 2 years ago

#41334 closed defect (bug) (fixed)

get_comment_author_url sends an empty value to its filters

Reported by: dominik.schwind Owned by: johnbillion
Milestone: 4.9 Priority: normal
Severity: normal Version: 4.6
Component: Comments Keywords: has-patch has-unit-tests
Focuses: Cc:

Description

In line 309 of comment-template.php $id gets reassigned to $comment->ID, which does not exist, therefore all get_comment_author_url-filters get null instead of the id.

Attachments (2)

comment-template.diff (503 bytes) - added by dominik.schwind 3 years ago.
This patch should fix that problem.
getCommentAuthorUrl.php (718 bytes) - added by dominik.schwind 3 years ago.
Test the get_comment_author_url filter.

Download all attachments as: .zip

Change History (8)

@dominik.schwind
3 years ago

This patch should fix that problem.

#1 @dominik.schwind
3 years ago

  • Keywords has-patch added

#2 @johnbillion
3 years ago

  • Keywords needs-unit-tests added
  • Milestone changed from Awaiting Review to 4.9
  • Version changed from trunk to 4.6

Thanks for the patch, @dominik.schwind, and welcome to WordPress Trac.

This was introduced in [37305] (cc @flixos90).

Ideally there should be a unit test here to catch this issue.

@dominik.schwind
3 years ago

Test the get_comment_author_url filter.

#3 @dominik.schwind
3 years ago

I'm not too sure if this test is enough, but it passes with the patch and fails without it.

#4 @johnbillion
3 years ago

  • Keywords has-unit-tests added; needs-unit-tests removed
  • Owner set to johnbillion
  • Status changed from new to reviewing

Looks good, thanks! I'll review properly shortly.

#5 @johnbillion
3 years ago

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

In 41127:

Comments: Ensure the correct comment ID is passed to the get_comment_author_url filter.

Props dominik.schwind

Fixes #41334

This ticket was mentioned in Slack in #core-js by aduth. View the logs.


2 years ago

Note: See TracTickets for help on using tickets.