forInvalidCookieName example

/** * Validates the cookie name per RFC 2616. * * If `$raw` is true, names should not contain invalid characters * as `setrawcookie()` will reject this. * * @throws CookieException */
    protected function validateName(string $name, bool $raw): void
    {
        if ($raw && strpbrk($name, self::$reservedCharsList) !== false) {
            throw CookieException::forInvalidCookieName($name);
        }

        if ($name === '') {
            throw CookieException::forEmptyCookieName();
        }
    }

    /** * Validates the special prefixes if some attribute requirements are met. * * @throws CookieException */
Home | Imprint | This part of the site doesn't use cookies.