8000 [HttpFoundation] Fixed Mime dependency missing error by HeahDude · Pull Request #35808 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[HttpFoundation] Fixed Mime dependency missing error #35808

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions UPGRADE-5.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ HttpFoundation
* Deprecate `Response::create()`, `JsonResponse::create()`,
`RedirectResponse::create()`, and `StreamedResponse::create()` methods (use
`__construct()` instead)
* Made the Mime component an optional dependency

Messenger
---------
Expand Down
4 changes: 4 additions & 0 deletions src/Symfony/Component/HttpFoundation/File/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ public function guessExtension()
*/
public function getMimeType()
{
if (!class_exists(MimeTypes::class)) {
throw new \LogicException('You cannot guess the mime type as the Mime component is not installed. Try running "composer require symfony/mime".');
}

return MimeTypes::getDefault()->guessMimeType($this->getPathname());
}

Expand Down
0