Browse Source

[HttpFoundation] populate $_SERVER with HTTP headers when calling Request::overrideGlobals()

wodkaist 15 năm trước cách đây
mục cha
commit
e931825b47
1 tập tin đã thay đổi với 4 bổ sung0 xóa
  1. 4 0
      src/Symfony/Components/HttpFoundation/Request.php

+ 4 - 0
src/Symfony/Components/HttpFoundation/Request.php

@@ -225,6 +225,10 @@ class Request
         $_COOKIES = $this->cookies->all();
         // FIXME: populate $_FILES
 
+        foreach ($this->headers->all() as $key => $value) {
+          $_SERVER['HTTP_'.strtoupper(str_replace('-', '_', $key))] = $value;
+        }
+
         // FIXME: should read variables_order and request_order
         // to know which globals to merge and in which order
         $_REQUEST = array_merge($_GET, $_POST);