Skip to content
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

MimeTypes::getMimeTypes() errors on custom mimetypes. #36715

Closed
mcneely opened this issue May 5, 2020 · 2 comments
Closed

MimeTypes::getMimeTypes() errors on custom mimetypes. #36715

mcneely opened this issue May 5, 2020 · 2 comments

Comments

@mcneely
Copy link
Contributor

mcneely commented May 5, 2020

Symfony version(s) affected: looks like 4.2+

Description
Type error: Type error: Return value of Symfony\Component\Mime\MimeTypes::getMimeTypes() must be of the type array, string returned when passing custom map through constructor.

How to reproduce
$type =(new MimeTypes([ 'application/octet-stream' => ['rrd'] ]))->getMimeTypes('rrd')

Possible Solution
Add []'s around $mimeType in constructor

@nicolas-grekas
Copy link
Member

Would you mind sending a fix with some test cases? From your description it should target 4.4.

mcneely added a commit to mcneely/symfony that referenced this issue May 5, 2020
mcneely added a commit to mcneely/symfony that referenced this issue May 5, 2020
@mcneely
Copy link
Contributor Author

mcneely commented May 5, 2020

@nicolas-grekas done.

@mcneely mcneely closed this as completed May 5, 2020
@mcneely mcneely reopened this May 5, 2020
mcneely added a commit to mcneely/symfony that referenced this issue May 5, 2020
@xabbuh xabbuh added the Mime label May 6, 2020
mcneely added a commit to mcneely/symfony that referenced this issue May 9, 2020
mcneely added a commit to mcneely/symfony that referenced this issue May 9, 2020
mcneely added a commit to mcneely/symfony that referenced this issue May 9, 2020
mcneely added a commit to mcneely/symfony that referenced this issue May 9, 2020
fabpot added a commit that referenced this issue May 9, 2020
This PR was merged into the 4.4 branch.

Discussion
----------

[Mime] handle passing custom mime types as string

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #36715
| License       | MIT
| Doc PR        | none
Fix's issue where custom mimetypes were failing

Commits
-------

f3005ec Fix for #36715
@mcneely mcneely closed this as completed May 9, 2020
nicolas-grekas added a commit that referenced this issue May 9, 2020
* 4.4:
  [HttpClient] improve testTimeoutIsNotAFatalError
  Fix for #36715
nicolas-grekas added a commit that referenced this issue May 9, 2020
* 5.0:
  [HttpClient] improve testTimeoutIsNotAFatalError
  Fix for #36715
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants