loginType]['cookieDomain'])) { $cookieDomain = $GLOBALS['TYPO3_CONF_VARS'][$this->loginType]['cookieDomain']; } if (!$cookieDomain) { return new CookieScope( domain: $normalizedParams->getRequestHostOnly(), hostOnly: true, // If no cookie domain is set, use the base path path: $normalizedParams->getSitePath(), ); } if ($cookieDomain[0] === '/') { $match = []; $matchCount = @preg_match($cookieDomain, $normalizedParams->getRequestHostOnly(), $match); if ($matchCount === false) { $this->logger->critical( 'The regular expression for the cookie domain ({domain}) contains errors. The session is not shared across sub-domains.', ['domain' => $cookieDomain] ); } if ($matchCount === false || $matchCount === 0) { return new CookieScope( domain: $normalizedParams->getRequestHostOnly(), hostOnly: true, // If no cookie domain could be matched, use the base path path: $normalizedParams->getSitePath(), ); } $cookieDomain = $match[0]; } return new CookieScope( // Normalize cookie domain by removing leading and trailing dots, // see https://www.rfc-editor.org/rfc/rfc6265#section-4.1.2.3 // > Note that a leading %x2E ("."), if present, is ignored even though that character is not permitted, // > but a trailing %x2E ("."), if present, will cause the user agent to ignore the attribute. domain: trim($cookieDomain, '.'), hostOnly: false, path: '/', ); } }