Cockpit-HQ / Cockpit

Cockpit Core - Content Platform
https://getcockpit.com
Other
388 stars 47 forks source link

clean ouput buffer before rendering 500-debug page #132

Closed raffaelj closed 1 year ago

aheinze commented 1 year ago

Can you provide some context here? And should this only enabled when debug is false?

raffaelj commented 1 year ago

Sorry, I thought, this was obvious. This is to prevent printing output above the error page, which leads at least to invalid html and in the worst case to unreadable error output because of broken html tags, css mismatches or javascript overlays.

It should be enabled regardless of the debug state.

addons/test/bootstrap.php:

<?php
$this->on('app.admin.request', function() {
    $this->bind('/test', function() {
        return $this->render('test:views/index.php');
    });
});

addons/test/views/index.php:

<p>output is rendered above error page</p>
<?=1/0?>

Output of error page:

<p>output is rendered above error page</p>
<html class="app-page-500-debug">
...
</html>
aheinze commented 1 year ago

👍