Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Kernel.php

function Kernel::preBoot

2 calls to Kernel::preBoot()
Kernel::boot in vendor/symfony/http-kernel/Kernel.php
Boots the current kernel.
Kernel::handle in vendor/symfony/http-kernel/Kernel.php
Handles a Request to convert it to a Response.

File

vendor/symfony/http-kernel/Kernel.php, line 729

Class

Kernel
The Kernel is the heart of the Symfony system.

Namespace

Symfony\Component\HttpKernel

Code

private function preBoot() : ContainerInterface {
    if ($this->debug) {
        $this->startTime = microtime(true);
    }
    if ($this->debug && !isset($_ENV['SHELL_VERBOSITY']) && !isset($_SERVER['SHELL_VERBOSITY'])) {
        if (\function_exists('putenv')) {
            putenv('SHELL_VERBOSITY=3');
        }
        $_ENV['SHELL_VERBOSITY'] = 3;
        $_SERVER['SHELL_VERBOSITY'] = 3;
    }
    $this->initializeBundles();
    $this->initializeContainer();
    $container = $this->container;
    if ($container->hasParameter('kernel.trusted_hosts') && ($trustedHosts = $container->getParameter('kernel.trusted_hosts'))) {
        Request::setTrustedHosts(\is_array($trustedHosts) ? $trustedHosts : preg_split('/\\s*+,\\s*+(?![^{]*})/', $trustedHosts));
    }
    if ($container->hasParameter('kernel.trusted_proxies') && $container->hasParameter('kernel.trusted_headers') && ($trustedProxies = $container->getParameter('kernel.trusted_proxies'))) {
        $trustedHeaders = $container->getParameter('kernel.trusted_headers');
        if (\is_string($trustedHeaders)) {
            $trustedHeaders = array_map('trim', explode(',', $trustedHeaders));
        }
        if (\is_array($trustedHeaders)) {
            $trustedHeaderSet = 0;
            foreach ($trustedHeaders as $header) {
                if (!\defined($const = Request::class . '::HEADER_' . strtr(strtoupper($header), '-', '_'))) {
                    throw new \InvalidArgumentException(\sprintf('The trusted header "%s" is not supported.', $header));
                }
                $trustedHeaderSet |= \constant($const);
            }
        }
        else {
            $trustedHeaderSet = $trustedHeaders ?? Request::HEADER_X_FORWARDED_FOR | Request::HEADER_X_FORWARDED_PORT | Request::HEADER_X_FORWARDED_PROTO;
        }
        Request::setTrustedProxies(\is_array($trustedProxies) ? $trustedProxies : array_map('trim', explode(',', $trustedProxies)), $trustedHeaderSet);
    }
    return $container;
}
RSS feed
Powered by Drupal