Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[HttpKernel] added Request::overrideGlobals()
  • Loading branch information
fabpot committed May 24, 2010
1 parent b949c8e commit 632ef95
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/Symfony/Components/HttpKernel/Request.php
Expand Up @@ -184,6 +184,24 @@ public function __clone()
$this->headers = clone $this->headers;
}

/**
* Overrides the PHP global variables according to this request instance.
*
* It overrides $_GET, $_POST, $_REQUEST, $_SERVER, $_COOKIES, and $_FILES.
*/
public function overrideGlobals()
{
$_GET = $this->query->all();
$_POST = $this->request->all();
$_SERVER = $this->server->all();
$_COOKIES = $this->cookies->all();
// FIXME: populate $_FILES

// FIXME: should read variables_order and request_order
// to know which globals to merge and in which order
$_REQUEST = array_merge($_GET, $_POST);
}

// Order of precedence: GET, PATH, POST, COOKIE
// Avoid using this method in controllers:
// * slow
Expand Down

0 comments on commit 632ef95

Please sign in to comment.