public static function Request::createFromGlobals

Creates a new request with values from PHP's super globals.

@api

Return value

Request A new request

6 calls to Request::createFromGlobals()
http.php in drupal/core/modules/system/tests/http.php
Fake an HTTP request, for use during testing.
https.php in drupal/core/modules/system/tests/https.php
Fake an HTTPS request, for use during testing.
index.php in drupal/index.php
The PHP page that serves all page requests on a Drupal installation.
install_begin_request in drupal/core/includes/install.core.inc
Begins an installation request, modifying the installation state as needed.
RequestTest::testCreateFromGlobals in drupal/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/RequestTest.php
@dataProvider provideOverloadedMethods

... See full list

File

drupal/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Request.php, line 216

Class

Request
Request represents an HTTP request.

Namespace

Symfony\Component\HttpFoundation

Code

public static function createFromGlobals() {
  $request = new static($_GET, $_POST, array(), $_COOKIE, $_FILES, $_SERVER);
  if (0 === strpos($request->server
    ->get('CONTENT_TYPE'), 'application/x-www-form-urlencoded') && in_array(strtoupper($request->server
    ->get('REQUEST_METHOD', 'GET')), array(
    'PUT',
    'DELETE',
    'PATCH',
  ))) {
    parse_str($request
      ->getContent(), $data);
    $request->request = new ParameterBag($data);
  }
  return $request;
}