You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug Message->setHeader() will accept any case for headers (as it should) but if different ones are supplied it will produce duplicate headers.
CodeIgniter 4 version
Latest develop branch
Affected module(s)
Message, Response, CURLRequest
Expected behavior, and steps to reproduce if appropriate
Consider the following:
The issue is that setHeader() isn't using the case-insensitive version from $headerMap when it checks isset:
if (! isset($this->headers[$name]))
{
$this->headers[$name] = new Header($name, $value);
$this->headerMap[strtolower($name)] = $name;
return $this;
}
if (! is_array($this->headers[$name]))
{
$this->headers[$name] = [$this->headers[$name]];
}
if (isset($this->headers[$name]))
{
$this->headers[$name] = new Header($name, $value);
}
There's also something weird here, because it essentially has a logic redundancy: if (! isset($x)) and if (isset($x)), and the middle array check does nothing because it is immediately overwritten by the following statement.
Describe the bug
Message->setHeader()
will accept any case for headers (as it should) but if different ones are supplied it will produce duplicate headers.CodeIgniter 4 version
Latest develop branch
Affected module(s)
Message, Response, CURLRequest
Expected behavior, and steps to reproduce if appropriate
Consider the following:
This should produce one header, but it produces two with each case-sensitive key.
EDIT - output of example:
The text was updated successfully, but these errors were encountered: