Don't create system notices for errors in user-entered ad-hoc PHP (diag_command.php)

This commit is contained in:
stilez 2017-05-27 14:14:46 +01:00 committed by GitHub
parent 1155cd6318
commit ff4e29fb9d

View File

@ -908,7 +908,8 @@ function pfSense_clear_globals() {
$error = error_get_last();
if ($error !== NULL) {
// Errors generated by user code (diag_commands.php) are identified by path and not added to notices
if ($error !== NULL && !preg_match('^' . $g['tmp_path_user_code'] . '/[^/]{1,16}$', $error['file'])) {
if (in_array($error['type'], array(E_ERROR, E_COMPILE_ERROR, E_CORE_ERROR, E_RECOVERABLE_ERROR))) {
$errorstr = "PHP ERROR: Type: {$error['type']}, File: {$error['file']}, Line: {$error['line']}, Message: {$error['message']}";
print($errorstr);