Skip to content

Commit 17184f3

Browse files
committed
minor symfony#13509 [2.3] [HttpFoundation] [MimeTypeGuesser] Updated exception in MimeTypeGuesser (phansys)
This PR was merged into the 2.3 branch. Discussion ---------- [2.3] [HttpFoundation] [MimeTypeGuesser] Updated exception in MimeTypeGuesser | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | symfony#12857 | License | MIT | Doc PR | none Updated exception message in MimeTypeGuesser when no guessers available (issue symfony#12857). Commits ------- 1e4a8d5 [2.3] [HttpFoundation] [MimeTypeGuesser]
2 parents 6000f60 + 1e4a8d5 commit 17184f3

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeGuesser.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,11 @@ public function guess($path)
120120
}
121121

122122
if (!$this->guessers) {
123-
throw new \LogicException('Unable to guess the mime type as no guessers are available (Did you enable the php_fileinfo extension?)');
123+
$msg = 'Unable to guess the mime type as no guessers are available';
124+
if (!FileinfoMimeTypeGuesser::isSupported()) {
125+
$msg .= ' (Did you enable the php_fileinfo extension?)';
126+
}
127+
throw new \LogicException($msg);
124128
}
125129

126130
foreach ($this->guessers as $guesser) {

0 commit comments

Comments
 (0)