klein/klein.php

Output buffer caching

Closed this issue · 1 comments

In my application I call ob_start() before using Klein and output that after calling $klein->dispatch(). This seems to not work - does Klein call die() after completion? I've tested with $k->dispatch(); echo "hello world" and I do not see the text.

I think Klein uses output buffering in its own dispatch process. So you are effectively calling:

ob_start;
ob_start;
ob_flush;
ob_flush;

I have never done that, but I think there is only one buffer. So when Klein flushes, it flushes everything.

I'm not sure why the echo would fail though. Klein doesn't die after dispatch; my so runs a bunch of shut down code after the dispatch.