Skip to content

Commit b094ad3

Browse files
committed
drop support for HTTP method override for GET, HEAD, CONNECT and TRACe requests
1 parent bdd3582 commit b094ad3

File tree

3 files changed

+3
-5
lines changed

3 files changed

+3
-5
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ CHANGELOG
44
8.0
55
---
66

7+
* Drop HTTP method override support for methods GET, HEAD, CONNECT and TRACE
78
* Add argument `$subtypeFallback` to `Request::getFormat()`
89
* Remove the following deprecated session options from `NativeSessionStorage`: `referer_check`, `use_only_cookies`, `use_trans_sid`, `sid_length`, `sid_bits_per_character`, `trans_sid_hosts`, `trans_sid_tags`
910
* Trigger PHP warning when using `Request::sendHeaders()` after headers have already been sent; use a `StreamedResponse` instead

Request.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1210,7 +1210,7 @@ public function getMethod(): string
12101210
$method = strtoupper($method);
12111211

12121212
if (\in_array($method, ['GET', 'HEAD', 'CONNECT', 'TRACE'], true)) {
1213-
trigger_deprecation('symfony/http-foundation', '7.4', 'HTTP method override is deprecated for methods GET, HEAD, CONNECT and TRACE; it will be ignored in Symfony 8.0.', $method);
1213+
return $this->method;
12141214
}
12151215

12161216
if (self::$allowedHttpMethodOverride && !\in_array($method, self::$allowedHttpMethodOverride, true)) {

Tests/RequestTest.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1076,16 +1076,13 @@ public function testGetSetMethod()
10761076
$this->assertSame('POST', $request->getMethod(), '->getMethod() returns the request method if invalid type is defined in query');
10771077
}
10781078

1079-
#[IgnoreDeprecations]
1080-
#[Group('legacy')]
10811079
public function testUnsafeMethodOverride()
10821080
{
10831081
$request = new Request();
10841082
$request->setMethod('POST');
10851083
$request->headers->set('X-HTTP-METHOD-OVERRIDE', 'get');
10861084

1087-
$this->expectUserDeprecationMessage('Since symfony/http-foundation 7.4: HTTP method override is deprecated for methods GET, HEAD, CONNECT and TRACE; it will be ignored in Symfony 8.0.');
1088-
$this->assertSame('GET', $request->getMethod());
1085+
$this->assertSame('POST', $request->getMethod());
10891086
}
10901087

10911088
#[DataProvider('getClientIpsProvider')]

0 commit comments

Comments
 (0)