Closed rbchasesc closed 6 years ago
@rbchasesc
…before writing the headers array to to the headers protected variable.
Sorry, this is wrong. Look at the next line:
$headerNames !== $headers
See also:
As @froschdesign notes, we do keep track of the original casing, and that casing is used when emitting or serializing headers. We normalize the names in $headers
to allow simplified lookups, but store the originally provided values in $headerNames
, which is used for representation.
According to the PSR-7 MessageInterface - Case-insensitive header field names, it states:
However, the
\Zend\Diactoros\MessageTrait::setHeaders
method at Line 327 is performing astrtolower
on each header name before writing the headers array to to theheaders
protected variable. In doing so, the original header names' case is lost, which appears to be in violation of PSR-7. If this is a violation and to be corrected, it will require changes to other header related methods as they are all assuming the normalization to lowercase for the names has been completed when accessing theheaders
variable.