My own PHP framework parses files like this to grab the content:
ob_start();
include($file);
$content = ob_get_clean();
However, now I am working on an own error_handler
to display an error page if any error occured even when it's happning in a template parsed like the code piece demonstrates above.
The funny thing is the content of the included template is printed to the browser when code execution dies due to an error for example. That of course makes my error-page looks very bad.
Shouldn't the opening of an output buffer prevent printing the content?
Especially because ob_get_clean() should clear the content after parsing it.
Why is this happening?
If I don't run into an error the website is working as intended.
How can I fix this problem?