This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
symfony/src/Symfony/Component/Mime
Fabien Potencier 6cc2c293bc bug #34032 [Mime] Fixing multidimensional array structure with FormDataPart (jvahldick)
This PR was merged into the 4.4 branch.

Discussion
----------

[Mime] Fixing multidimensional array structure with FormDataPart

| Q             | A
| ------------- | ---
| Branch?       | 4.3
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #33063 #34031
| License       | MIT
| Doc PR        | -

The issue is pretty much described on #34031
The current structure of the raw body build on FormDataPart is not well recognized by the server. It considers all the fields as a root type, when actually it is possible to send arrays by html forms.

Lets the following structure on the html
```html
<input type="text" name="names[]" value="John" />
<input type="text" name="names[]" value="Doe" />
```

It creates the following raw body:
```
----------------------------466490401959219490193856
Content-Disposition: form-data; name="names[]"

John
----------------------------466490401959219490193856
Content-Disposition: form-data; name="names[]"

Doe
----------------------------466490401959219490193856--
```

Meanwhile, the FormDataPart on Mime component generates the following body:
```
--_=_symfony_1571410799_b7846b3b4e86d821cdec4379e62b4068_=_
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Content-Disposition: form-data

John
--_=_symfony_1571410799_b7846b3b4e86d821cdec4379e62b4068_=_
Content-Type: text/plain; charset=utf-8; name=1
Content-Transfer-Encoding: 8bit
Content-Disposition: form-data; name=1

Doe
--_=_symfony_1571410799_b7846b3b4e86d821cdec4379e62b4068_=_--
```

For more complex structures, the $_POST doesn't even recognize properly the field names and values.

Commits
-------

ca630e5351 Changing the multipart form-data behavior to use the form name as an array, which makes it recognizable as an array by PHP on the $_POST globals once it is coming from the HttpClient component
2019-11-30 09:27:26 +01:00
..
Crypto [Mime] add check for openssl when using SMime 2019-07-05 09:42:08 +02:00
DependencyInjection removed @experimental annotations 2019-06-29 18:43:50 +02:00
Encoder removed @experimental annotations 2019-06-29 18:43:50 +02:00
Exception removed @experimental annotations 2019-06-29 18:43:50 +02:00
Header Merge branch '4.3' into 4.4 2019-09-24 17:57:39 +02:00
Part Changing the multipart form-data behavior to use the form name as an array, which makes it recognizable as an array by PHP on the $_POST globals once it is coming from the HttpClient component 2019-10-18 16:40:54 +01:00
Resources/bin [Mime] fixed wrong mimetype 2019-08-07 12:03:27 +02:00
Test/Constraint Merge branch '4.3' into 4.4 2019-08-14 14:37:46 +02:00
Tests bug #34032 [Mime] Fixing multidimensional array structure with FormDataPart (jvahldick) 2019-11-30 09:27:26 +01:00
.gitattributes Add .gitignore to .gitattributes 2019-10-12 01:35:04 +01:00
.gitignore [Mime] added the component 2019-01-16 23:56:01 +01:00
Address.php fixed CSC 2019-08-22 11:15:28 +02:00
BodyRendererInterface.php removed @experimental annotations 2019-06-29 18:43:50 +02:00
CHANGELOG.md Add Address::fromString 2019-08-22 11:10:30 +02:00
CharacterStream.php Merge branch '4.3' into 4.4 2019-10-30 14:23:44 +01:00
composer.json Merge branch '4.3' into 4.4 2019-08-22 10:37:03 +02:00
Email.php [Mailer] Check email validity before opening an SMTP connection 2019-09-06 15:51:50 +02:00
FileBinaryMimeTypeGuesser.php Merge branch '4.3' into 4.4 2019-11-13 08:39:40 +01:00
FileinfoMimeTypeGuesser.php removed @experimental annotations 2019-06-29 18:43:50 +02:00
LICENSE [Mime] added the component 2019-01-16 23:56:01 +01:00
Message.php Add Message-Id to SentMessage when sending an email 2019-10-12 10:43:49 +02:00
MessageConverter.php removed @experimental annotations 2019-06-29 18:43:50 +02:00
MimeTypeGuesserInterface.php removed @experimental annotations 2019-06-29 18:43:50 +02:00
MimeTypes.php added image/svg MIME support 2019-10-08 14:15:27 +02:00
MimeTypesInterface.php removed @experimental annotations 2019-06-29 18:43:50 +02:00
phpunit.xml.dist [Mime] added the component 2019-01-16 23:56:01 +01:00
RawMessage.php [Mailer] Check email validity before opening an SMTP connection 2019-09-06 15:51:50 +02:00
README.md Remove experimental notice from components 2019-07-11 11:03:49 +02:00

MIME Component

The MIME component allows manipulating MIME messages.

Resources