summaryrefslogtreecommitdiff
path: root/error.php
blob: 5b65ab32fe89584827f7b2ee65911ad088cbbe99 (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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
<?php function ch_error($level, $message, $file = null, $line = null, $context = null) {
    if ($level === E_USER_DEPRECATED || $level === E_DEPRECATED) return false;

    ob_end_clean();

    ?>

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>500 Internal server error ยท Cold Haze</title>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
    <link rel="shortcut icon" href="/assets/logo/newlogo.png" type="image/png">
    <style>
        html, body {
            background: black;
            color: white;
        }

        .list-group-item {
            color: #fff;
            background-color: #222;
            border: 1px solid rgba(255, 255, 255, .125);
        }

        .list-group-item.disabled {
            color: #fff;
            background-color: #222;
            border-color: rgba(255, 255, 255, .125);
            opacity: .75;
        }

        .list-group-item:hover {
            background-color: #252525;
            color: #ddd;
        }

        .list-group-item:active, .list-group-item:focus {
            background-color: #272727;
            color: #bbb;
        }
    </style>
</head>
<body>
    <div class="container" style="margin-top: 50px;">
        <h1>500 Internal server error</h1>
        <p>We apologize, but an error occurred while rendering this page. As a consequence, we are currently unable to process your request. Please try this again later. You may also want to <a href="https://bugs.equestria.dev/newIssue?project=CH" target="_blank" style="filter: invert(1) hue-rotate(180deg);">report this to us</a>, so we can quickly fix it.</p>
        <div class="list-group">
            <a href="/" class="list-group-action list-group-item">Go to the home page</a>
            <a href="/-/jobs" class="list-group-action list-group-item">Access the jobs list (for administrators)</a>
        </div>
        <hr>
        <pre>
   Cold Haze crash report
   ======================

   Code <?= $level ?> [<?php

            if ($level === E_ERROR) echo("E_ERROR");
            if ($level === E_WARNING) echo("E_WARNING");
            if ($level === E_NOTICE) echo("E_NOTICE");
            if ($level === E_USER_ERROR) echo("E_USER_ERROR");
            if ($level === E_USER_WARNING) echo("E_USER_WARNING");
            if ($level === E_USER_NOTICE) echo("E_USER_NOTICE");
            if ($level === E_STRICT) echo("E_STRICT");
            if ($level === E_ALL) echo("E_ALL");
            if ($level === E_COMPILE_ERROR) echo("E_ALL");
            if ($level === E_COMPILE_WARNING) echo("E_ALL");
            if ($level === E_CORE_ERROR) echo("E_ALL");
            if ($level === E_CORE_WARNING) echo("E_ALL");
            if ($level === E_PARSE) echo("E_PARSE");
            if ($level === E_RECOVERABLE_ERROR) echo("E_RECOVERABLE_ERROR");

            ?>]
   <?= $message ?>


=> In <?= $file ?> (line <?= $line ?>) <=

     00 <?= strtoupper(substr(md5($level), 0, 8)) ?>

     01 <?= strtoupper(substr(md5($message), 0, 8)) ?>

     02 <?= strtoupper(substr(md5($file), 0, 8)) ?>

     03 <?= strtoupper(substr(md5($line), 0, 8)) ?>


<?php $sp = 0; foreach (array_reverse(debug_backtrace()) as $item): ?>
 <?= ($item["file"] ?? "[unknown file]") === $file ? "*" : " " ?> <?= str_repeat(" ", $sp) ?><?= $item["file"] ?? "[unknown file]" ?>:<?= $item["line"] ?? "?" ?> => <?= $item["function"] ?? "???" ?>

<?php $sp += 4; endforeach; ?>


<?php foreach (get_included_files() as $f): ?>
 <?= $f === $file ? "*" : " " ?> <?= $f ?>

<?php endforeach; ?>

<?php foreach ($_SERVER as $item => $value): ?>
   <?= $item ?>: <?= ($item === "HTTP_COOKIE") ? "[redacted for privacy]" : $value ?>

<?php endforeach; ?>

   memory_get_usage(): <?php var_dump(memory_get_usage()); ?>
   memory_get_peak_usage(): <?php var_dump(memory_get_peak_usage()); ?>
   phpversion(): <?php var_dump(phpversion()); ?>
   php_uname(): <?php var_dump(php_uname()); ?>
   zend_version(): <?php var_dump(zend_version()); ?>
   getmypid(): <?php var_dump(getmypid()); ?>
   getmyuid(): <?php var_dump(getmyuid()); ?>
   getmygid(): <?php var_dump(getmygid()); ?>
   getmyinode(): <?php var_dump(getmyinode()); ?>
        </pre>
    </div>
</body>
</html>

<?php die(); } ?>