aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private
diff options
context:
space:
mode:
authorprovokateurin <kate@provokateurin.de>2024-12-16 16:20:48 +0100
committerprovokateurin <kate@provokateurin.de>2025-02-03 12:11:01 +0100
commit53c02d6b9d1ed4868b77c846dc141fe4c5cf503c (patch)
tree79cbeb98bf295a1ca795c1113c98a70d7da740c0 /lib/private
parent384f3c0b0795e43488a49f4fc372f890fd26030c (diff)
downloadnextcloud-server-53c02d6b9d1ed4868b77c846dc141fe4c5cf503c.tar.gz
nextcloud-server-53c02d6b9d1ed4868b77c846dc141fe4c5cf503c.zip
fix(Http): Only allow valid HTTP status code values via templatebackport/49882/stable29
Signed-off-by: provokateurin <kate@provokateurin.de>
Diffstat (limited to 'lib/private')
-rw-r--r--lib/private/AppFramework/OCS/BaseResponse.php4
-rw-r--r--lib/private/AppFramework/OCS/V1Response.php6
-rw-r--r--lib/private/AppFramework/OCS/V2Response.php6
3 files changed, 8 insertions, 8 deletions
diff --git a/lib/private/AppFramework/OCS/BaseResponse.php b/lib/private/AppFramework/OCS/BaseResponse.php
index 4f460795e7f..d82a3135da3 100644
--- a/lib/private/AppFramework/OCS/BaseResponse.php
+++ b/lib/private/AppFramework/OCS/BaseResponse.php
@@ -33,10 +33,10 @@ use OCP\AppFramework\Http\Response;
/**
* @psalm-import-type DataResponseType from DataResponse
- * @template S of int
+ * @template S of Http::STATUS_*
* @template-covariant T of DataResponseType
* @template H of array<string, mixed>
- * @template-extends Response<int, array<string, mixed>>
+ * @template-extends Response<Http::STATUS_*, array<string, mixed>>
*/
abstract class BaseResponse extends Response {
/** @var array */
diff --git a/lib/private/AppFramework/OCS/V1Response.php b/lib/private/AppFramework/OCS/V1Response.php
index e6b01652789..a3e571e32c8 100644
--- a/lib/private/AppFramework/OCS/V1Response.php
+++ b/lib/private/AppFramework/OCS/V1Response.php
@@ -31,17 +31,17 @@ use OCP\AppFramework\OCSController;
/**
* @psalm-import-type DataResponseType from DataResponse
- * @template S of int
+ * @template S of Http::STATUS_*
* @template-covariant T of DataResponseType
* @template H of array<string, mixed>
- * @template-extends BaseResponse<int, DataResponseType, array<string, mixed>>
+ * @template-extends BaseResponse<Http::STATUS_*, DataResponseType, array<string, mixed>>
*/
class V1Response extends BaseResponse {
/**
* The V1 endpoint has very limited http status codes basically everything
* is status 200 except 401
*
- * @return int
+ * @return Http::STATUS_*
*/
public function getStatus() {
$status = parent::getStatus();
diff --git a/lib/private/AppFramework/OCS/V2Response.php b/lib/private/AppFramework/OCS/V2Response.php
index 1e81a3c7d93..ade0de9dd26 100644
--- a/lib/private/AppFramework/OCS/V2Response.php
+++ b/lib/private/AppFramework/OCS/V2Response.php
@@ -30,17 +30,17 @@ use OCP\AppFramework\OCSController;
/**
* @psalm-import-type DataResponseType from DataResponse
- * @template S of int
+ * @template S of Http::STATUS_*
* @template-covariant T of DataResponseType
* @template H of array<string, mixed>
- * @template-extends BaseResponse<int, DataResponseType, array<string, mixed>>
+ * @template-extends BaseResponse<Http::STATUS_*, DataResponseType, array<string, mixed>>
*/
class V2Response extends BaseResponse {
/**
* The V2 endpoint just passes on status codes.
* Of course we have to map the OCS specific codes to proper HTTP status codes
*
- * @return int
+ * @return Http::STATUS_*
*/
public function getStatus() {
$status = parent::getStatus();