webgui: handle php 500 when display_errors is off

Revert previous here.  Debug mode is "raw" error display
mode and non-debug forwards to crash reporter.

Crash reporter itself could be broken, but mostly because
the system / include chain is broken.  Until PHP offers
a reliable way to intercept parse error 500 we will have
to live with this unless it causes other side effects.
This commit is contained in:
kulikov-a 2022-07-16 18:31:47 +03:00 committed by Franco Fichtner
parent 575c8a5233
commit af0c9e18a2
4 changed files with 19 additions and 1 deletions

1
plist
View File

@ -251,6 +251,7 @@
/usr/local/opnsense/data/proxy/template_error_pages/ERR_ZERO_SIZE_OBJECT.html
/usr/local/opnsense/data/proxy/template_error_pages/error-details.txt
/usr/local/opnsense/data/proxy/template_error_pages/errorpage.css
/usr/local/opnsense/data/webgui/status-500.html
/usr/local/opnsense/mvc/app/cache/README
/usr/local/opnsense/mvc/app/config/config.php
/usr/local/opnsense/mvc/app/config/loader.php

View File

@ -434,6 +434,12 @@ EOD;
$lighty_config .= "}\n";
}
if (empty($config['system']['deployment']) || $config['system']['deployment'] == 'development') {
$lighty_config .= "# send static error pages for some errors in non-debug mode\n";
$lighty_config .= "server.error-intercept = \"enable\"\n";
$lighty_config .= "server.errorfile-prefix = \"/usr/local/opnsense/data/webgui/status-\"\n";
}
$lighty_config .= <<<EOD
## error-handler for status 404

View File

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<title>HTTP ERROR 500</title>
<meta charset="UTF-8" />
<meta http-equiv="refresh" content="0; URL=/crash_reporter.php" />
</head>
<body>
<p>Server returned a HTTP 500 ERROR. If you are not redirected, click <a href="/crash_reporter.php">here</a> to view the crash report.</p>
</body>
</html>

View File

@ -25,7 +25,7 @@ error_reporting = E_ALL ^ (E_WARNING | E_NOTICE | E_DEPRECATED | E_STRICT | E_CO
{% else %}
error_reporting = E_ALL
{% endif %}
display_errors={% if system.deployment|default("") != "" %}on{%else%}off{%endif%}
display_errors={% if system.deployment|default("") == "debug" %}on{%else%}off{%endif%}
display_startup_errors={% if system.deployment|default("") == "debug" %}on{%else%}off{%endif%}