Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit b3b368b

Browse filesBrowse files
minor #35808 [HttpFoundation] Fixed Mime dependency missing error (HeahDude)
This PR was merged into the 5.1-dev branch. Discussion ---------- [HttpFoundation] Fixed Mime dependency missing error | Q | A | ------------- | --- | Branch? | master | Bug fix? | kinda | New feature? | no | Deprecations? | no | Tickets | ~ | License | MIT | Doc PR | ~ Follows #35642, by adding a missing exception and a note in the UPGRADE file (CHANGELOG in HttpFoundation was already up to date). Reported in symfony/symfony-docs#1307 Commits ------- fef0de3 [HttpFoundation] Fixed Mimes dependency missing error
2 parents 269c4a2 + fef0de3 commit b3b368b
Copy full SHA for b3b368b

File tree

2 files changed

+5
-0
lines changed
Filter options

2 files changed

+5
-0
lines changed

‎UPGRADE-5.1.md

Copy file name to clipboardExpand all lines: UPGRADE-5.1.md
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ HttpFoundation
3636
* Deprecate `Response::create()`, `JsonResponse::create()`,
3737
`RedirectResponse::create()`, and `StreamedResponse::create()` methods (use
3838
`__construct()` instead)
39+
* Made the Mime component an optional dependency
3940

4041
Messenger
4142
---------

‎src/Symfony/Component/HttpFoundation/File/File.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpFoundation/File/File.php
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,10 @@ public function guessExtension()
7474
*/
7575
public function getMimeType()
7676
{
77+
if (!class_exists(MimeTypes::class)) {
78+
throw new \LogicException('You cannot guess the mime type as the Mime component is not installed. Try running "composer require symfony/mime".');
79+
}
80+
7781
return MimeTypes::getDefault()->guessMimeType($this->getPathname());
7882
}
7983

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.