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
Hi, I am writing directly to php://output in my action because I do not want to buffer (large) output in memory or on disk. However, Slim quietly elects not to send headers in this case, because ResponseEmitter::emit notices headers_sent now returns true. How can I still send custom headers whilst writing output directly to PHP's output stream?
The solution is this old 2015 implementation of CallbackStream. Current implementations in either psr7examples or laminas-diactoros will not work. The former won't because it uses output buffering (lol why) and the latter doesn't because it implements getContents() in lieu of read(), but Slim's ResponseEmitter calls read() instead of getContents().
I might urge the maintainers to include the only working implementation hidden away in that lone gist before it gets lost to time.
Hi, I am writing directly to
php://output
in my action because I do not want to buffer (large) output in memory or on disk. However, Slim quietly elects not to send headers in this case, becauseResponseEmitter::emit
noticesheaders_sent
now returnstrue
. How can I still send custom headers whilst writing output directly to PHP's output stream?Note: Symfony supports this with StreamedResponse.
The text was updated successfully, but these errors were encountered: