-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathno-warning.php
More file actions
38 lines (36 loc) · 1.01 KB
/
no-warning.php
File metadata and controls
38 lines (36 loc) · 1.01 KB
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
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
setlocale(LC_TIME, 'ita', 'it_IT.utf8');
error_reporting(E_ERROR | E_PARSE);
function ErrorToErrorPage($errno, $errstr, $errfile, $errline)
{
$file = urlencode($errfile);
if (isset($errstr) && isset($errno))
{
$str = urlencode($errstr);
header("Location: ./error.php?err=$str&code=$errno&file=$file");
} else {
header("Location: ./error.php?file=$file");
}
exit;
}
set_error_handler("ErrorToErrorPage", E_STRICT);
function ExceptionToErrorPage(Error|Exception $ex)
{
if (!isset($ex))
{
header("Location: ./error.php");
exit;
}
$err = urlencode($ex->getMessage());
$code = $ex->getCode();
$file = urlencode($ex->getFile());
$trace = urlencode($ex->getTraceAsString());
if (is_int($code))
{
header("Location: ./error.php?err=$err&code=$code&file=$file&trace=$trace");
} else {
header("Location: ./error.php?err=$err&file=$file&trace=$trace");
}
exit;
}
set_exception_handler("ExceptionToErrorPage");