瀏覽代碼

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

wodkaist 15 年之前
父節點
當前提交
e931825b47
共有 1 個文件被更改,包括 4 次插入0 次删除
  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);