Skip to content
This repository has been archived by the owner on Jan 30, 2020. It is now read-only.

Commit

Permalink
Merge pull request zendframework/zendframework#1562 from SocalNick/ho…
Browse files Browse the repository at this point in the history
…tfix/request-cookie-handling

Fixing cookie handling in request object
  • Loading branch information
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/PhpEnvironment/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ public function __construct()
$this->setPost(new Parameters($_POST));
$this->setQuery(new Parameters($_GET));
$this->setServer(new Parameters($_SERVER));
$this->setCookies(new Parameters($_COOKIE));
if ($_COOKIE) {
$this->setCookies(new Parameters($_COOKIE));
}

if ($_FILES) {
$this->setFile(new Parameters($_FILES));
Expand Down Expand Up @@ -236,6 +238,10 @@ protected function serverToHeaders($server)

foreach ($server as $key => $value) {
if ($value && strpos($key, 'HTTP_') === 0) {
if (strpos($key, 'HTTP_COOKIE') === 0) {
// Cookies are handled using the $_COOKIE superglobal
continue;
}
$name = strtr(substr($key, 5), '_', ' ');
$name = strtr(ucwords(strtolower($name)), ' ', '-');
} elseif ($value && strpos($key, 'CONTENT_') === 0) {
Expand Down

0 comments on commit de0cb77

Please sign in to comment.