Provides an easy interface for performing Hyper-Text Transfer Protocol (HTTP) requests
BSD 3-Clause "New" or "Revised" License
36
stars
27
forks
source link
`Headers#toArray` does not properly return all header values #60
Closed
boesing closed 2 years ago
Description
When working on a project in combination with the
laminas/laminas-psr7bridge
andlaminas/laminas-diactoros
, we ran into a bug where theHeaders#toArray
method iterated over its (not initialized) headers and thus extended the array which is currently iterated withinHeaders#lazyLoadHeader
: https://github.com/laminas/laminas-http/blob/e1f3420ab35e21ea135913d213b8d570e5e7b513/src/Headers.php#L507Not sure if this ever worked properly tho. Maybe another problem is that
Set-Cookie
is merged into a single value in https://github.com/laminas/laminas-psr7bridge/blob/a560f42d66fc11b0b05e7d2103e69e434365e7c1/src/Psr7Response.php#L80 as well but as of now, extending an iterator while its being iterated simply won't work for an array and thus, I've rewritten the way howHeaders#toArray
works by enforcing the lazy conversion before iterating over the headers.