|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #75121 PHP cuts out charset information from content-type in file uploads
Submitted: 2017-08-25 15:12 UTC Modified: -
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: jocrutrisi at ibsats dot com Assigned:
Status: Open Package: Unknown/Other Function
PHP Version: 7.2.0beta3 OS: All
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2017-08-25 15:12 UTC] jocrutrisi at ibsats dot com
Seems like PHP cuts out attributes, including charset, from "Content-Type" when assigning the "type" attribute in file uploads:

That's information loss, this information is important when processing text uploads.

I realize doing the right thing (assigning full type to "type") is now not an option for BC reasons.

But I'd like to propose that we add another field to the $_FILES file entry, "charset", which contains the charset when it's there (and when it's not, the field can be missing or null).


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2017-08-25 15:19 UTC]
Wow....that's something.

Could you post an example for content-type string so that when it gets fixed, someone has an example to add as a test.
 [2017-08-25 15:28 UTC] jocrutrisi at ibsats dot com
It's covered here (and elsewhere):

Basically it looks like (the names ARE CASE-INSENSITIVE, much like header names):

Content-Type: text/plain; charset=utf-8

The charset is not always supplied, but in some cases it is. It's possible that other attributes may also be appended in the same fashion, but I don't think any are documented right now (there's the boundary but that's only for multipart content)
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 17 04:01:28 2024 UTC