use Drupal\Component\FileCache\FileCacheFactory;
use Drupal\Component\Utility\Unicode;
use Drupal\Component\Utility\UrlHelper;
+use Drupal\Core\Cache\DatabaseBackend;
use Drupal\Core\Config\BootstrapConfigStorageFactory;
use Drupal\Core\Config\NullStorage;
use Drupal\Core\Database\Database;
use Drupal\Core\Http\TrustedHostsRequestFactory;
use Drupal\Core\Installer\InstallerRedirectTrait;
use Drupal\Core\Language\Language;
+use Drupal\Core\Security\RequestSanitizer;
use Drupal\Core\Site\Settings;
use Drupal\Core\Test\TestDatabase;
use Symfony\Cmf\Component\Routing\RouteObjectInterface;
],
'cache.container' => [
'class' => 'Drupal\Core\Cache\DatabaseBackend',
- 'arguments' => ['@database', '@cache_tags_provider.container', 'container'],
+ 'arguments' => ['@database', '@cache_tags_provider.container', 'container', DatabaseBackend::MAXIMUM_NONE],
],
'cache_tags_provider.container' => [
'class' => 'Drupal\Core\Cache\DatabaseCacheTagsChecksum',
* {@inheritdoc}
*/
public function setSitePath($path) {
- if ($this->booted) {
+ if ($this->booted && $path !== $this->sitePath) {
throw new \LogicException('Site path cannot be changed after calling boot()');
}
$this->sitePath = $path;
* {@inheritdoc}
*/
public function preHandle(Request $request) {
+ // Sanitize the request.
+ $request = RequestSanitizer::sanitize(
+ $request,
+ (array) Settings::get(RequestSanitizer::SANITIZE_WHITELIST, []),
+ (bool) Settings::get(RequestSanitizer::SANITIZE_LOG, FALSE)
+ );
$this->loadLegacyIncludes();
*
* @param \Exception $e
* An exception
- * @param Request $request
+ * @param \Symfony\Component\HttpFoundation\Request $request
* A Request instance
* @param int $type
* The type of the request (one of HttpKernelInterface::MASTER_REQUEST or
* HttpKernelInterface::SUB_REQUEST)
*
- * @return Response
+ * @return \Symfony\Component\HttpFoundation\Response
* A Response instance
*
* @throws \Exception
// new session into the master request if one was present before.
if (($request_stack = $this->container->get('request_stack', ContainerInterface::NULL_ON_INVALID_REFERENCE))) {
if ($request = $request_stack->getMasterRequest()) {
+ $subrequest = TRUE;
if ($request->hasSession()) {
$request->setSession($this->container->get('session'));
}
\Drupal::setContainer($this->container);
+ // Allow other parts of the codebase to react on container initialization in
+ // subrequest.
+ if (!empty($subrequest)) {
+ $this->container->get('event_dispatcher')->dispatch(self::CONTAINER_INITIALIZE_SUBREQUEST_FINISHED);
+ }
+
// If needs dumping flag was set, dump the container.
if ($this->containerNeedsDumping && !$this->cacheDrupalContainer($container_definition)) {
$this->container->get('logger.factory')->get('DrupalKernel')->error('Container cannot be saved to cache.');
/**
* Attach synthetic values on to kernel.
*
- * @param ContainerInterface $container
+ * @param \Symfony\Component\DependencyInjection\ContainerInterface $container
* Container object
*
- * @return ContainerInterface
+ * @return \Symfony\Component\DependencyInjection\ContainerInterface
*/
protected function attachSynthetic(ContainerInterface $container) {
$persist = [];
/**
* Compiles a new service container.
*
- * @return ContainerBuilder The compiled service container
+ * @return \Drupal\Core\DependencyInjection\ContainerBuilder The compiled service container
*/
protected function compileContainer() {
// We are forcing a container build so it is reasonable to assume that the
/**
* Gets a new ContainerBuilder instance used to build the service container.
*
- * @return ContainerBuilder
+ * @return \Drupal\Core\DependencyInjection\ContainerBuilder
*/
protected function getContainerBuilder() {
return new ContainerBuilder(new ParameterBag($this->getKernelParameters()));