Commit b49cc7d
committed
feature #61979 [HttpFoundation] Add
This PR was merged into the 7.4 branch.
Discussion
----------
[HttpFoundation] Add `Request::set/getAllowedHttpMethodOverride()` to list which HTTP methods can be overridden
| Q | A
| ------------- | ---
| Branch? | 7.4
| Bug fix? | no
| New feature? | yes
| Deprecations? | no
| Issues | -
| License | MIT
This feature addresses https://github.com/symfony/symfony/pull/61949/files#r2402280654 and hardens HttpFoundation by giving control over which HTTP methods can be overridden:
```php
Request::setAllowedHttpMethodOverride(['PUT', 'PATCH', 'DELETE']);
```
Providing no method disables verb tunneling altogether:
```php
Request::setAllowedHttpMethodOverride([]);
```
This setting can be set using standard Symfony configuration:
```yaml
framework:
allowed_http_method_override: ['PUT', 'DELETE', 'PATCH']
```
2 implementations note:
- This doesn't update the XSD file on purpose: that format is deprecated and handling it would mean adding more complexity that nobody will benefit from in practice.
- This isn't compatible with defining the list of allowed methods using env vars. This could be added later if one has a use case for that. Until it happens, I prefer keeping the code simpler.
Commits
-------
a4f51c9548c [HttpFoundation] Add `Request::$allowedHttpMethodOverride` to list which HTTP methods can be overriddenRequest::set/getAllowedHttpMethodOverride() to list which HTTP methods can be overridden (nicolas-grekas)3 files changed
+81
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
84 | 91 | | |
85 | 92 | | |
86 | 93 | | |
| |||
680 | 687 | | |
681 | 688 | | |
682 | 689 | | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
683 | 714 | | |
684 | 715 | | |
685 | 716 | | |
| |||
1197 | 1228 | | |
1198 | 1229 | | |
1199 | 1230 | | |
1200 | | - | |
| 1231 | + | |
1201 | 1232 | | |
1202 | 1233 | | |
1203 | 1234 | | |
| |||
1213 | 1244 | | |
1214 | 1245 | | |
1215 | 1246 | | |
1216 | | - | |
1217 | | - | |
| 1247 | + | |
| 1248 | + | |
1218 | 1249 | | |
1219 | 1250 | | |
1220 | | - | |
| 1251 | + | |
1221 | 1252 | | |
1222 | 1253 | | |
1223 | 1254 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| 36 | + | |
36 | 37 | | |
37 | 38 | | |
38 | 39 | | |
| |||
255 | 256 | | |
256 | 257 | | |
257 | 258 | | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
258 | 303 | | |
259 | 304 | | |
260 | 305 | | |
| |||
0 commit comments