blob: ba236ac20ab16f5c1ff3d6dd2207abf21f8eef4c (
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) {
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');
|