symfony/http-foundation · error · InvalidArgumentException
At least one separator must be specified.
Error message
At least one separator must be specified.
What it means
An InvalidArgumentException raised by HeaderUtils::split() when its $separators argument is an empty string. split() builds a regex character class from the separator characters and cannot split on nothing, so an empty separator list is a programming error detected before any parsing happens; the header string itself is irrelevant here.
Solutions
- Pass at least one separator character, e.g. HeaderUtils::split($header, ',;')
- Validate $separators is non-empty before calling split()
- Return or process the header unsplit (e.g. explode on a known delimiter) when no separators apply
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at HeaderUtils.php:48 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of symfony/http-foundation@5aea19cd67 (2026-09-13).
Data as JSON: /api/errors/d8ba0d1cee242176.
Report an issue: GitHub.
Appendix: source
Thrown at HeaderUtils.php:48
public static function split(string $header, string $separators): array
{
if ('' === $separators) {
throw new \InvalidArgumentException('At least one separator must be specified.');
}
$quotedSeparators = preg_quote($separators, '/');
preg_match_all('
/
(?!\s)
(?:
# quoted-string
"(?:[^"\\\\]|\\\\.)*(?:"|\\\\|$)
|
# token
[^"'.$quotedSeparators.']+
)+
(?<!\s)
|
# separator
\s*
(?<separator>['.$quotedSeparators.'])
\s*View on GitHub (pinned to 5aea19cd67)