|
@@ -184,6 +184,24 @@ class Request
|
|
$this->headers = clone $this->headers;
|
|
$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
|
|
// Order of precedence: GET, PATH, POST, COOKIE
|
|
// Avoid using this method in controllers:
|
|
// Avoid using this method in controllers:
|
|
// * slow
|
|
// * slow
|