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
All of its methods are a bit of a wild-card to find out if they are working or not, looking at the implementation and after some testing, not all of them seem to & will behave as one would expect.
e.g. ->getSize() does work, because the $this->remoteStream variable is called directly.
However since ->detach() is implemented through the StreamDecoratorTrait, the detach method is using the $this->stream property, which is seeded by the $target constructor argument of CachingStream.
How to reproduce
Since I think CachingStream is the cause of the problem, I'll limit the steps to that class only.
PHP version: 8.1
Library version: 2.6.2
Description
When using
ServerRequest::fromGlobals()->getBody()->detach()
the returnedresource
has an empty content.Looking into its internals the request body stream is wrapped with a
CachingStream
https://github.com/guzzle/psr7/blob/2.6/src/ServerRequest.php#L171All of its methods are a bit of a wild-card to find out if they are working or not, looking at the implementation and after some testing, not all of them seem to & will behave as one would expect.
e.g.
->getSize()
does work, because the$this->remoteStream
variable is called directly.However since
->detach()
is implemented through theStreamDecoratorTrait
, thedetach
method is using the$this->stream
property, which is seeded by the$target
constructor argument ofCachingStream
.How to reproduce
Since I think
CachingStream
is the cause of the problem, I'll limit the steps to that class only.Now, passing the body to the
$target
constructor property too, resolves the problem again, instead->getSize()
all of a sudden is broken.Do you require any other information from me?
Can you confirm this can be labeled as a bug?
What would be the proposed work-around?
Thank you.
The text was updated successfully, but these errors were encountered: