I have questions regarding Slim’s handling of the body stream. In
ResponseEmitter, the body stream is read until
true but the stream is never closed.
My main concern is during file downloads, file handles created via
fopen and used to construct a stream are not being closed. However, I have never proven this to be true. I assume PHP automatically cleans up open file handles before the script exits. Is that assumption correct?
I’m sure there’s a reason the stream isn’t closed after emitting the response. Would someone be able to explain to me why?
Edit: According to this StackOverflow post, file handles are automatically cleaned upon script termination. But they do point out that there are some security concerns with leaving the handles open.