public function onBuildKernelHandler(PreBuildKernelEvent $event)
    {
        $sessionInfos = [
            'configured' => false,
            'started' => false,
            'name' => false,
            'namespace' => false,
            'has_previous' => false,
            'storage' => false,
        ];
        if (isset($this->session)) {
            $request = $this->getCurrentRequest();
            $sessionInfos['configured'] = true;
            $sessionInfos['name'] = $this->session->getName();
            $sessionInfos['started'] = $this->session->isStarted();
            $sessionInfos['namespace'] = $this->sessionStorageKey;
            $sessionInfos['has_previous'] = isset($request) ? $request->hasPreviousSession() : false;
            $sessionInfos['storage'] = $this->sessionStorage;
        }

        $legacyKernelParameters = $event->getParameters();
        $legacyKernelParameters->set('session', $sessionInfos);

        // Deactivate session cookie settings in legacy kernel.
        // This will force using settings defined in Symfony.
        $sessionSettings = [
            'site.ini/Session/CookieTimeout' => false,
            'site.ini/Session/CookiePath' => false,
            'site.ini/Session/CookieDomain' => false,
            'site.ini/Session/CookieSecure' => false,
            'site.ini/Session/CookieHttponly' => false,
        ];
        $legacyKernelParameters->set(
            'injected-settings',
            $sessionSettings + (array)$legacyKernelParameters->get('injected-settings')
        );
    }