Make WordPress Core

Opened 16 years ago

Closed 16 years ago

#14907 closed defect (bug) (fixed)

Comment type is not correctly passed to wp_notify_postauthor in wp_new_comment()

Reported by: solarissmoke Owned by:
Priority: normal Milestone: 3.1
Component: Comments Version: 3.1
Severity: normal Keywords: has-patch
Cc: Focuses:

Description

Line 1285 of wp-includes/comment.php (part of wp_new_comment) reads as follows:

wp_notify_postauthor($comment_ID, empty( $commentdata['comment_type'] ) ? $commentdata['comment_type'] : '' );

The ternary operation is flawed. If $commentdatacomment_type is empty, then that empty value is returned. If it isn't empty, then an empty string is returned. Either way, an empty value is always passed to wp_notify_postauthor.

I think the check should be !empty() instead. That way a non-empty value is passed properly to the function. Proposed patch attached.

Attachments (1)

correct_notify_postauthor.patch​ (747 bytes ) - added by solarissmoke 16 years ago.
Check for !empty() instead of empty()

Download all attachments as: .zip

Change History (2)

@solarissmoke
16 years ago

Check for !empty() instead of empty()

#1 @scribu
16 years ago

  • Milestone Awaiting Review → 3.1
  • Resolution → fixed
  • Status new → closed

This has already been fixed: [15491]

Note: See TracTickets for help on using tickets.