Commit 8a90232
committed
feature #61961 [HttpFoundation] Make
This PR was merged into the 7.4 branch.
Discussion
----------
[HttpFoundation] Make `Request::createFromGlobals()` parse the body of PUT, DELETE, PATCH and QUERY requests
| Q | A
| ------------- | ---
| Branch? | 7.4
| Bug fix? | no
| New feature? | yes
| Deprecations? | no
| Issues | Fix #59331
| License | MIT
Seeing that #59358 is stalled I’m opening this PR in the hope of seeing this feature in 7.4/8.0 (if it’s okay with you `@rottifant`).
When using PHP ≥ 8.4, this PR will try to parse a `PUT`, `DELETE`, `PATCH` or `QUERY` request body using `request_parse_body` to populate `Request::$request` and `$files`.
No options are passed so that `php.ini` settings apply.
`RequestParseBodyException` (thrown when the request body is invalid, according to the `Content-Type`) is ignored for now.
An important point is that when dealing with `multipart/form-data` requests, `request_parse_body` will only work if the input stream hasn’t been consumed (by reading `php://input` or by another call to `request_parse_body`). This PR won’t override `Request::$request` and `$files` so that the input stream can be read before `createFromGlobals` is called, but I don’t know how to preserve BC if it is read after (in which case it will be empty).
Commits
-------
e052345 [HttpFoundation] Make `Request::createFromGlobals()` use `request_parse_body` when possibleRequest::createFromGlobals() parse the body of PUT, DELETE, PATCH and QUERY requests (MatTheCat)File tree
5 files changed
+182
-40
lines changed- src/Symfony/Component/HttpFoundation
- Tests
- Fixtures/request-functional
5 files changed
+182
-40
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
280 | 280 | | |
281 | 281 | | |
282 | 282 | | |
283 | | - | |
284 | | - | |
285 | | - | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
286 | 296 | | |
287 | 297 | | |
288 | 298 | | |
| |||
Lines changed: 45 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
Lines changed: 97 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
Lines changed: 26 additions & 37 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
24 | | - | |
25 | 25 | | |
26 | | - | |
27 | 26 | | |
28 | 27 | | |
29 | 28 | | |
| |||
1281 | 1280 | | |
1282 | 1281 | | |
1283 | 1282 | | |
1284 | | - | |
| 1283 | + | |
1285 | 1284 | | |
1286 | 1285 | | |
1287 | 1286 | | |
1288 | 1287 | | |
1289 | 1288 | | |
1290 | | - | |
1291 | | - | |
1292 | | - | |
| 1289 | + | |
1293 | 1290 | | |
1294 | 1291 | | |
1295 | 1292 | | |
| |||
1331 | 1328 | | |
1332 | 1329 | | |
1333 | 1330 | | |
1334 | | - | |
1335 | | - | |
| 1331 | + | |
1336 | 1332 | | |
1337 | | - | |
1338 | | - | |
1339 | 1333 | | |
1340 | 1334 | | |
1341 | 1335 | | |
1342 | 1336 | | |
1343 | 1337 | | |
1344 | 1338 | | |
1345 | 1339 | | |
1346 | | - | |
1347 | | - | |
1348 | | - | |
1349 | | - | |
1350 | | - | |
1351 | | - | |
1352 | | - | |
| 1340 | + | |
| 1341 | + | |
| 1342 | + | |
| 1343 | + | |
| 1344 | + | |
| 1345 | + | |
| 1346 | + | |
| 1347 | + | |
| 1348 | + | |
| 1349 | + | |
| 1350 | + | |
1353 | 1351 | | |
1354 | | - | |
| 1352 | + | |
1355 | 1353 | | |
| 1354 | + | |
| 1355 | + | |
| 1356 | + | |
| 1357 | + | |
| 1358 | + | |
| 1359 | + | |
| 1360 | + | |
1356 | 1361 | | |
1357 | 1362 | | |
1358 | | - | |
1359 | | - | |
1360 | | - | |
1361 | | - | |
1362 | | - | |
1363 | 1363 | | |
1364 | | - | |
1365 | | - | |
1366 | | - | |
1367 | | - | |
1368 | | - | |
1369 | | - | |
1370 | | - | |
1371 | | - | |
1372 | | - | |
1373 | | - | |
1374 | | - | |
| 1364 | + | |
1375 | 1365 | | |
1376 | | - | |
1377 | | - | |
| 1366 | + | |
1378 | 1367 | | |
1379 | 1368 | | |
1380 | 1369 | | |
| |||
2675 | 2664 | | |
2676 | 2665 | | |
2677 | 2666 | | |
2678 | | - | |
| 2667 | + | |
2679 | 2668 | | |
2680 | 2669 | | |
2681 | 2670 | | |
| |||
0 commit comments