You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpFoundation/Request.php
+18-2Lines changed: 18 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -672,8 +672,24 @@ public static function setTrustedHeaderName($key, $value)
672
672
{
673
673
@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);
674
674
675
-
if (!array_key_exists($key, self::$trustedHeaders)) {
676
-
thrownew \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
+
thrownew \InvalidArgumentException(sprintf('Unable to set the trusted header name for key "%s".', $key));
0 commit comments