WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 4 years ago

#10854 closed defect (bug) (fixed)

Can't post comments by XMLRPC using wp.newComment and having WP_DEBUG enabled

Reported by: filipegiusti Owned by: josephscott
Milestone: 3.0 Priority: normal
Severity: normal Version: 2.8.4
Component: Comments Keywords:
Focuses: Cc:

Description

When posting a comment by XMLRPC with all errors enable you get

<br /> Notice: Undefined variable: comment_type in XXX/wordpress/wp-includes/comment.php on line 433<br />
<br /> Notice: Undefined index: comment_type in XXX/wordpress/wp-includes/comment.php on line 1006<br />

Some warnings about rewriting the header and then the right xml response.

Tracking down the problem it seems that comment_type isn't set nowhere in XXX/wordpress/xmlrpc.php at wp_newComment (line 1253)

Change History (3)

comment:1 josephscott5 years ago

So far I haven't been able to reproduce this (at least on -trunk). I defined WP_DEBUG as true and added a new comment via an XML-RPC wp.newComment method.

Can you provide specific steps to reproduce this?

comment:2 nacin4 years ago

  • Component changed from XML-RPC to Comments
  • Milestone changed from Unassigned to 3.0

Looking through the code (both trunk and the 2.8.4 tag), it seems legit.

wp_new_comment()'s $commentdata may not have comment_type set. That is handled by wp_insert_comment() if it is unset.

But wp_new_comment() then uses comment_type under certain conditions in order to notify the postauthor.

Looks like we should check for the comment_type index, either at that point, or earlier.

comment:3 dd324 years ago

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

nacin's commit skiped over the ticket.

[13937] Fix notice in wp_new_comment(). fixes #10854.

Note: See TracTickets for help on using tickets.