Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Return WP_Error in get_comment for invalid comments - resolves #166 #171

Merged
merged 1 commit into from

2 participants

@tlovett1

No description provided.

@rmccue rmccue added the Bug label
@rmccue rmccue added this to the 1.0 milestone
@rmccue rmccue self-assigned this
@rmccue rmccue merged commit 0113bf4 into WP-API:master

1 check passed

Details continuous-integration/travis-ci The Travis CI build passed
@rmccue
Owner

Thanks! :palm_tree:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 4 additions and 0 deletions.
  1. +4 −0 lib/class-wp-json-posts.php
View
4 lib/class-wp-json-posts.php
@@ -393,6 +393,10 @@ public function get_comments( $id ) {
*/
public function get_comment( $comment ) {
$comment = get_comment( $comment );
+ if ( empty( $comment ) ) {
+ return new WP_Error( 'json_comment_invalid_id', __( 'Invalid comment ID.' ), array( 'status' => 404 ) );
+ }
+
$data = $this->prepare_comment( $comment );
return $data;
}
Something went wrong with that request. Please try again.