From c76c47e303e7af4e7318e03d526d54165a288a44 Mon Sep 17 00:00:00 2001 From: srijaydeathwish Date: Fri, 28 Jan 2022 12:31:04 +0530 Subject: [PATCH] Fixed "Trying to access array offset on value of type null" in Random.php --- src/FileUpload/FileNameGenerator/Random.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/FileUpload/FileNameGenerator/Random.php b/src/FileUpload/FileNameGenerator/Random.php index f3b6238..062555d 100644 --- a/src/FileUpload/FileNameGenerator/Random.php +++ b/src/FileUpload/FileNameGenerator/Random.php @@ -67,7 +67,9 @@ protected function getUniqueFilename($name, $type, $index, $content_range, $exte $name = $this->generateRandom() . "." . $extension; } - $uploaded_bytes = Util::fixIntegerOverflow(intval($content_range[1])); + if (!empty($content_range)) { + $uploaded_bytes = Util::fixIntegerOverflow(intval($content_range[1])); + } while ($this->filesystem->isFile($this->pathresolver->getUploadPath($name))) { if ($uploaded_bytes == $this->filesystem->getFilesize($this->pathresolver->getUploadPath($name))) {