Skip to content

Commit

Permalink
REST API PATCH /issue/:id now fails with HTTP 400
Browse files Browse the repository at this point in the history
Previously, PHP warnings would be triggered when the payload is empty.

Fixes #27973
  • Loading branch information
dregad committed Feb 20, 2021
1 parent f2ee0a6 commit 9807fa2
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions api/rest/restcore/issues_rest.php
Expand Up @@ -368,6 +368,9 @@ function rest_issue_update( \Slim\Http\Request $p_request, \Slim\Http\Response $

# Construct full issue from issue from db + patched info
$t_issue_patch = $p_request->getParsedBody();
if( !$t_issue_patch ) {
return $p_response->withStatus( HTTP_STATUS_BAD_REQUEST, "Invalid request body or format");
}
if( isset( $t_issue_patch['id'] ) && $t_issue_patch['id'] != $t_issue_id ) {
return $p_response->withStatus( HTTP_STATUS_BAD_REQUEST, 'Issue id mismatch' );
}
Expand Down

0 comments on commit 9807fa2

Please sign in to comment.