From d5e3edbe81c8f5ff1d8d38fb29badd4efd249e1e Mon Sep 17 00:00:00 2001 From: smile1980 Date: Thu, 8 Oct 2020 19:56:32 +0300 Subject: [PATCH] Update ContentDisposition.php --- src/Header/ContentDisposition.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Header/ContentDisposition.php b/src/Header/ContentDisposition.php index 5594afb8..4e3165a5 100644 --- a/src/Header/ContentDisposition.php +++ b/src/Header/ContentDisposition.php @@ -148,7 +148,11 @@ public function getFieldValue($format = HeaderInterface::FORMAT_RAW) $decodedLength = strlen($value); $maxValueLength -= ($encodedLength - $decodedLength); } - + + // there are cases when the value becomes less than 1, str_split tell "Warning: str_split(): The length of each segment must be greater than zero" + if ( $maxValueLength < 1 ) + $maxValueLength = 1; + $valueParts = str_split($value, $maxValueLength); $i = 0; foreach ($valueParts as $valuePart) {