Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 3450c7a

Browse filesBrowse files
committed
add back support for legacy constant values
1 parent 25df7a1 commit 3450c7a
Copy full SHA for 3450c7a

File tree

1 file changed

+18
-2
lines changed
Filter options

1 file changed

+18
-2
lines changed

‎src/Symfony/Component/HttpFoundation/Request.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpFoundation/Request.php
+18-2Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -672,8 +672,24 @@ public static function setTrustedHeaderName($key, $value)
672672
{
673673
@trigger_error(sprintf('The "%s()" method is deprecated since version 3.3 and will be removed in 4.0. Use the $trustedHeaderSet argument of the Request::setTrustedProxies() method instead.', __METHOD__), E_USER_DEPRECATED);
674674

675-
if (!array_key_exists($key, self::$trustedHeaders)) {
676-
throw new \InvalidArgumentException(sprintf('Unable to set the trusted header name for key "%s".', $key));
675+
switch ($key) {
676+
case 'forwared':
677+
$key = self::HEADER_FORWARDED;
678+
break;
679+
case 'client_ip':
680+
$key = self::HEADER_CLIENT_IP;
681+
break;
682+
case 'client_host':
683+
$key = self::HEADER_CLIENT_HOST;
684+
break;
685+
case 'client_proto':
686+
$key = self::HEADER_CLIENT_PROTO;
687+
break;
688+
case 'client_port':
689+
$key = self::HEADER_CLIENT_PORT;
690+
break;
691+
default:
692+
throw new \InvalidArgumentException(sprintf('Unable to set the trusted header name for key "%s".', $key));
677693
}
678694

679695
self::$trustedHeaders[$key] = $value;

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.