[wp-trac] [WordPress Trac] #14907: Comment type is not correctly passed to wp_notify_postauthor in wp_new_comment()

WordPress Trac wp-trac at lists.automattic.com
Mon Sep 20 11:50:54 UTC 2010


#14907: Comment type is not correctly passed to wp_notify_postauthor in
wp_new_comment()
--------------------------+-------------------------------------------------
 Reporter:  solarissmoke  |       Owner:                 
     Type:  defect (bug)  |      Status:  new            
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Comments      |     Version:  3.1            
 Severity:  normal        |    Keywords:  has-patch      
--------------------------+-------------------------------------------------
 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 $commentdata['comment_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.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/14907>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list