瀏覽代碼

merged branch stloyd/patch-4 (PR #2018)

Commits
-------

542cfd6 [ServerBag] Skip unnecessary loop in `getHeaders()`

Discussion
----------

[ServerBag] Skip unnecessary loop in `getHeaders()`
Fabien Potencier 13 年之前
父節點
當前提交
9112bed669
共有 1 個文件被更改,包括 2 次插入5 次删除
  1. 2 5
      src/Symfony/Component/HttpFoundation/ServerBag.php

+ 2 - 5
src/Symfony/Component/HttpFoundation/ServerBag.php

@@ -26,11 +26,8 @@ class ServerBag extends ParameterBag
             if ('HTTP_' === substr($key, 0, 5)) {
             if ('HTTP_' === substr($key, 0, 5)) {
                 $headers[substr($key, 5)] = $value;
                 $headers[substr($key, 5)] = $value;
             }
             }
-        }
-
-        // CONTENT_TYPE and CONTENT_LENGTH are not prefixed with HTTP_
-        foreach (array('CONTENT_TYPE', 'CONTENT_LENGTH') as $key) {
-            if (isset($this->parameters[$key])) {
+            // CONTENT_* are not prefixed with HTTP_
+            elseif (in_array($key, array('CONTENT_LENGTH', 'CONTENT_MD5', 'CONTENT_TYPE'))) {
                 $headers[$key] = $this->parameters[$key];
                 $headers[$key] = $this->parameters[$key];
             }
             }
         }
         }