Skip to content

Commit 86c9c16

Browse files
authored
Resolved PHPStan issues (#537)
1 parent fd9ad6a commit 86c9c16

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/bundle/IO/BinaryStreamResponse.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
use DateTime;
1010
use Ibexa\Core\IO\IOServiceInterface;
1111
use Ibexa\Core\IO\Values\BinaryFile;
12+
use InvalidArgumentException;
1213
use LogicException;
1314
use Symfony\Component\HttpFoundation\BinaryFileResponse;
1415
use Symfony\Component\HttpFoundation\Request;
@@ -118,6 +119,13 @@ public function setContentDisposition($disposition, $filename = '', $filenameFal
118119

119120
if (empty($filenameFallback)) {
120121
$filenameFallback = mb_convert_encoding($filename, 'ASCII');
122+
123+
if ($filenameFallback === false) {
124+
throw new InvalidArgumentException(sprintf(
125+
'Could not convert filename "%s" to ASCII. It contains invalid or non-ASCII byte sequences.',
126+
$filename
127+
));
128+
}
121129
}
122130

123131
$dispositionHeader = $this->headers->makeDisposition($disposition, $filename, $filenameFallback);

0 commit comments

Comments
 (0)