From 41e116f7d4014218f3e161f08c9df4c724a8aa53 Mon Sep 17 00:00:00 2001 From: Clemens Schwaighofer Date: Wed, 18 Dec 2024 10:11:47 +0900 Subject: [PATCH] phpstan checks for level 9 --- phpstan.neon | 2 +- www/lib/FileUpload/Core/qqUploadedFileXhr.php | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/phpstan.neon b/phpstan.neon index 1d6c4ff5..6d3c1508 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -9,7 +9,7 @@ parameters: #friendly: # lineBefore: 3 # lineAfter: 3 - level: 8 # max is now 9 + level: 8 # max is now 10 # strictRules: # allRules: false checkMissingCallableSignature: true diff --git a/www/lib/FileUpload/Core/qqUploadedFileXhr.php b/www/lib/FileUpload/Core/qqUploadedFileXhr.php index 98494145..c1a359cc 100644 --- a/www/lib/FileUpload/Core/qqUploadedFileXhr.php +++ b/www/lib/FileUpload/Core/qqUploadedFileXhr.php @@ -46,19 +46,19 @@ class qqUploadedFileXhr implements qqUploadedFile // phpcs:ignore Squiz.Classes. */ public function getName(): string { - return $_GET['qqfile'] ?? ''; + return !empty($_GET['qqfile']) && is_string($_GET['qqfile']) ? $_GET['qqfile'] : ''; } /** * Get file size from _SERVERa array, throws an error if not possible * - * @return int + * @return int size of the file * * @throws \Exception */ public function getSize(): int { - if (isset($_SERVER['CONTENT_LENGTH'])) { + if (isset($_SERVER['CONTENT_LENGTH']) && is_numeric($_SERVER['CONTENT_LENGTH'])) { return (int)$_SERVER['CONTENT_LENGTH']; } else { throw new \Exception('Getting content length is not supported.');