From: Xavier Perseguers Date: Fri, 21 Jul 2017 11:53:38 +0000 (+0200) Subject: [BUGFIX] Use HTTP 400 instead of 500 when client is faulty X-Git-Tag: v9.0.0~743 X-Git-Url: http://git.typo3.org/Packages/TYPO3.CMS.git/commitdiff_plain/a57ea45b63611bcc5bae408c70424bd2f1915407 [BUGFIX] Use HTTP 400 instead of 500 when client is faulty When checking for precondition in the request, HTTP 400 code should be returned whenever the client is responsible for having issued a bad request. HTTP 500 indicates an internal error on the server, which is not the case under such circumstance. Change-Id: Ib7e63428b1a84b63e1a2a0c9d95513972be83d33 Resolves: #81941 Releases: master, 8.7 Reviewed-on: https://review.typo3.org/53564 Tested-by: TYPO3com Reviewed-by: Markus Klein Tested-by: Markus Klein Reviewed-by: Helmut Hummel Reviewed-by: Joerg Boesche Reviewed-by: Wouter Wolters Reviewed-by: Andreas Fernandez Tested-by: Andreas Fernandez --- diff --git a/typo3/sysext/backend/Classes/Controller/Page/LocalizationController.php b/typo3/sysext/backend/Classes/Controller/Page/LocalizationController.php index 21ed99c7ac6f..a049cc002411 100644 --- a/typo3/sysext/backend/Classes/Controller/Page/LocalizationController.php +++ b/typo3/sysext/backend/Classes/Controller/Page/LocalizationController.php @@ -68,7 +68,7 @@ class LocalizationController { $params = $request->getQueryParams(); if (!isset($params['pageId'], $params['colPos'], $params['languageId'])) { - $response = $response->withStatus(500); + $response = $response->withStatus(400); return $response; } @@ -123,7 +123,7 @@ class LocalizationController { $params = $request->getQueryParams(); if (!isset($params['pageId'], $params['colPos'], $params['destLanguageId'], $params['languageId'])) { - $response = $response->withStatus(500); + $response = $response->withStatus(400); return $response; } @@ -157,13 +157,13 @@ class LocalizationController { $params = $request->getQueryParams(); if (!isset($params['pageId'], $params['srcLanguageId'], $params['destLanguageId'], $params['action'], $params['uidList'])) { - $response = $response->withStatus(500); + $response = $response->withStatus(400); return $response; } if ($params['action'] !== static::ACTION_COPY && $params['action'] !== static::ACTION_LOCALIZE) { $response->getBody()->write('Invalid action "' . $params['action'] . '" called.'); - $response = $response->withStatus(500); + $response = $response->withStatus(400); return $response; }