FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
php-error-handler/example/server.php at master · MrWook/php-error-handler · GitHub
MrWook
/
php-error-handler
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Issues
0
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
php-error-handler
/
example
/
server.php
Copy path
More file actions
More file actions
Latest commit
History
History
History
46 lines (42 loc) · 1.04 KB
Breadcrumbs
php-error-handler
/
example
/
server.php
Copy path
File metadata and controls
46 lines (42 loc) · 1.04 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
39
40
41
42
43
44
45
46
<?php
//init error handler
include
(
'
../src/mw-php-error.php
'
);
error_init
(
'
logging
'
);
function
logging
(
$
type
,
$
log_object
,
$
dataset
){
//write into log file
$
myfile
=
fopen
(
"
log.txt
"
,
"
a
"
);
$
text
=
json_encode
([
"
date
"
=>
date
(
"
Y-m-d H:i:s
"
),
"
log_object
"
=>
$
log_object
,
"
dataset
"
=>
$
dataset
]).
PHP_EOL
;
fwrite
(
$
myfile
,
$
text
);
fclose
(
$
myfile
);
//response with a clean text
$
response
= [
'
type
'
=>
'
warning
'
,
'
text
'
=>
'
An error occured
'
];
echo
json_encode
(
$
response
);
}
//tests
if
(
$
_POST
[
'
type
'
] ==
'
timeout
'
) {
while
(
true
){
$
a
=
1
;
}
}
elseif
(
$
_POST
[
'
type
'
] ==
'
overflow
'
) {
$
b
=
'
aaaaaaaaaaa
'
;
while
(
true
){
$
b
.=
$
b
.
$
b
.
$
b
.
$
b
.
$
b
.
$
b
;
}
}
elseif
(
$
_POST
[
'
type
'
] ==
'
error
'
) {
include
(
'
server_error.php
'
);
}
elseif
(
$
_POST
[
'
type
'
] ==
'
exception
'
) {
$
error
=
'
Always throw this error
'
;
throw
new
Exception
(
$
error
);
}
elseif
(
$
_POST
[
'
type
'
] ==
'
error_with_parameter
'
){
$
log_object
= [];
$
log_object
[
'
foo
'
] =
'
bar
'
;
$
log_info
[
'
information
'
] =
'
This is awsome
'
;
include
(
'
server_error.php
'
);
}
Back
|
FazBrowse Home
|
New Git URL