Skip to content

Document ResourceStream close behavior#52

Merged
veewee merged 1 commit intophpro:v2.xfrom
veewee:resource-stream-close-docs
Apr 7, 2026
Merged

Document ResourceStream close behavior#52
veewee merged 1 commit intophpro:v2.xfrom
veewee:resource-stream-close-docs

Conversation

@veewee
Copy link
Copy Markdown
Contributor

@veewee veewee commented Apr 7, 2026

Summary

  • Documents that ResourceStreamEncoder shares the underlying PHP resource with PSR-7, so StreamInterface::close() also closes the original ResourceStream
  • Suggests copying the stream (e.g. via copyTo(MemoryStream::create())) when reuse after sending a request is needed

The underlying PHP resource is shared between the ResourceStream
and the PSR-7 stream, so closing one closes the other. Document
this and suggest copying the stream when reuse is needed.
@veewee veewee force-pushed the resource-stream-close-docs branch from c150697 to 0785ded Compare April 7, 2026 08:23
@veewee veewee merged commit a532b2d into phpro:v2.x Apr 7, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant