summaryrefslogtreecommitdiff
path: root/includes/error.php
blob: 1450a280f2070f7be1729027a01692b178579094 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<?php
function user_notice($message) {
	echo '<p class="error">'. $message .'</p>';
}

function handle_error($errno, $errstr, $errfile, $errline) {
	if (!(error_reporting() & $errno)) {
		// This error code is not included in error_reporting, so let it fall
		// through to the standard PHP error handler
		return false;
	}

	switch ($errno) {
		// See https://www.php.net/manual/en/errorfunc.constants.php
		case E_USER_NOTICE:
			user_notice($errstr);
			break;
		default:
			return false;
	}
	return true;
}

$old_error_handler = set_error_handler('handle_error');
?>