2023-07-06 15:56:05 +00:00
|
|
|
<?php
|
2021-05-06 14:00:48 +00:00
|
|
|
|
2023-07-06 15:56:05 +00:00
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
use CodeIgniter\CodeIgniter;
|
2024-04-26 09:26:22 +00:00
|
|
|
use CodeIgniter\HTTP\Header;
|
2023-07-06 15:56:05 +00:00
|
|
|
use Config\Services;
|
|
|
|
|
|
|
|
$errorId = uniqid('error', true);
|
|
|
|
?>
|
2020-05-27 18:46:16 +02:00
|
|
|
<!doctype html>
|
|
|
|
<html>
|
|
|
|
<head>
|
2021-04-02 17:20:02 +00:00
|
|
|
<meta charset="UTF-8">
|
|
|
|
<meta name="robots" content="noindex">
|
|
|
|
|
|
|
|
<title><?= esc($title) ?></title>
|
2023-07-06 15:56:05 +00:00
|
|
|
<style>
|
2022-03-04 14:33:48 +00:00
|
|
|
<?= preg_replace('#[\r\n\t ]+#', ' ', file_get_contents(__DIR__ . DIRECTORY_SEPARATOR . 'debug.css')) ?>
|
2021-04-02 17:20:02 +00:00
|
|
|
</style>
|
|
|
|
|
2023-07-06 15:56:05 +00:00
|
|
|
<script>
|
2021-04-02 17:20:02 +00:00
|
|
|
<?= file_get_contents(__DIR__ . DIRECTORY_SEPARATOR . 'debug.js') ?>
|
|
|
|
</script>
|
2020-05-27 18:46:16 +02:00
|
|
|
</head>
|
|
|
|
<body onload="init()">
|
|
|
|
|
2021-04-02 17:20:02 +00:00
|
|
|
<!-- Header -->
|
|
|
|
<div class="header">
|
2024-04-26 09:26:22 +00:00
|
|
|
<div class="environment">
|
|
|
|
Displayed at <?= esc(date('H:i:sa')) ?> —
|
|
|
|
PHP: <?= esc(PHP_VERSION) ?> —
|
|
|
|
CodeIgniter: <?= esc(CodeIgniter::CI_VERSION) ?> --
|
|
|
|
Environment: <?= ENVIRONMENT ?>
|
|
|
|
</div>
|
2021-04-02 17:20:02 +00:00
|
|
|
<div class="container">
|
2021-05-25 10:40:22 +00:00
|
|
|
<h1><?= esc($title), esc($exception->getCode() ? ' #' . $exception->getCode() : '') ?></h1>
|
2021-04-02 17:20:02 +00:00
|
|
|
<p>
|
2021-05-25 10:40:22 +00:00
|
|
|
<?= nl2br(esc($exception->getMessage())) ?>
|
2022-03-04 14:33:48 +00:00
|
|
|
<a href="https://www.duckduckgo.com/?q=<?= urlencode($title . ' ' . preg_replace('#\'.*\'|".*"#Us', '', $exception->getMessage())) ?>"
|
|
|
|
rel="noreferrer" target="_blank">search →</a>
|
2021-04-02 17:20:02 +00:00
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<!-- Source -->
|
|
|
|
<div class="container">
|
2022-06-13 16:30:34 +00:00
|
|
|
<p><b><?= esc(clean_path($file, $line)) ?></b> at line <b><?= esc($line) ?></b></p>
|
2021-04-02 17:20:02 +00:00
|
|
|
|
2022-03-04 14:33:48 +00:00
|
|
|
<?php if (is_file($file)) : ?>
|
2021-04-02 17:20:02 +00:00
|
|
|
<div class="source">
|
2021-05-25 10:40:22 +00:00
|
|
|
<?= static::highlightFile($file, $line, 15); ?>
|
2021-04-02 17:20:02 +00:00
|
|
|
</div>
|
|
|
|
<?php endif; ?>
|
|
|
|
</div>
|
|
|
|
|
2024-01-01 22:54:59 +00:00
|
|
|
<div class="container">
|
|
|
|
<?php
|
|
|
|
$last = $exception;
|
|
|
|
|
|
|
|
while ($prevException = $last->getPrevious()) {
|
|
|
|
$last = $prevException;
|
|
|
|
?>
|
|
|
|
|
|
|
|
<pre>
|
|
|
|
Caused by:
|
2024-04-26 09:26:22 +00:00
|
|
|
<?= esc($prevException::class), esc($prevException->getCode() ? ' #' . $prevException->getCode() : '') ?>
|
2024-01-01 22:54:59 +00:00
|
|
|
|
|
|
|
<?= nl2br(esc($prevException->getMessage())) ?>
|
2024-04-26 09:26:22 +00:00
|
|
|
<a href="https://www.duckduckgo.com/?q=<?= urlencode($prevException::class . ' ' . preg_replace('#\'.*\'|".*"#Us', '', $prevException->getMessage())) ?>"
|
2024-01-01 22:54:59 +00:00
|
|
|
rel="noreferrer" target="_blank">search →</a>
|
|
|
|
<?= esc(clean_path($prevException->getFile()) . ':' . $prevException->getLine()) ?>
|
|
|
|
</pre>
|
|
|
|
|
|
|
|
<?php
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
</div>
|
|
|
|
|
2023-11-15 16:17:43 +00:00
|
|
|
<?php if (defined('SHOW_DEBUG_BACKTRACE') && SHOW_DEBUG_BACKTRACE) : ?>
|
2021-04-02 17:20:02 +00:00
|
|
|
<div class="container">
|
|
|
|
|
|
|
|
<ul class="tabs" id="tabs">
|
|
|
|
<li><a href="#backtrace">Backtrace</a></li>
|
2021-05-06 14:00:48 +00:00
|
|
|
<li><a href="#server">Server</a></li>
|
|
|
|
<li><a href="#request">Request</a></li>
|
|
|
|
<li><a href="#response">Response</a></li>
|
|
|
|
<li><a href="#files">Files</a></li>
|
|
|
|
<li><a href="#memory">Memory</a></li>
|
2021-04-02 17:20:02 +00:00
|
|
|
</ul>
|
|
|
|
|
|
|
|
<div class="tab-content">
|
|
|
|
|
|
|
|
<!-- Backtrace -->
|
|
|
|
<div class="content" id="backtrace">
|
|
|
|
|
|
|
|
<ol class="trace">
|
2022-03-04 14:33:48 +00:00
|
|
|
<?php foreach ($trace as $index => $row) : ?>
|
|
|
|
|
|
|
|
<li>
|
|
|
|
<p>
|
|
|
|
<!-- Trace info -->
|
2023-11-15 16:17:43 +00:00
|
|
|
<?php if (isset($row['file']) && is_file($row['file'])) : ?>
|
2022-03-04 14:33:48 +00:00
|
|
|
<?php
|
2024-01-01 22:54:59 +00:00
|
|
|
if (isset($row['function']) && in_array($row['function'], ['include', 'include_once', 'require', 'require_once'], true)) {
|
|
|
|
echo esc($row['function'] . ' ' . clean_path($row['file']));
|
|
|
|
} else {
|
|
|
|
echo esc(clean_path($row['file']) . ' : ' . $row['line']);
|
|
|
|
}
|
2023-02-22 16:29:45 +00:00
|
|
|
?>
|
2022-03-04 14:33:48 +00:00
|
|
|
<?php else : ?>
|
|
|
|
{PHP internal code}
|
|
|
|
<?php endif; ?>
|
|
|
|
|
|
|
|
<!-- Class/Method -->
|
|
|
|
<?php if (isset($row['class'])) : ?>
|
|
|
|
— <?= esc($row['class'] . $row['type'] . $row['function']) ?>
|
|
|
|
<?php if (! empty($row['args'])) : ?>
|
2023-07-06 15:56:05 +00:00
|
|
|
<?php $argsId = $errorId . 'args' . $index ?>
|
|
|
|
( <a href="#" onclick="return toggle('<?= esc($argsId, 'attr') ?>');">arguments</a> )
|
|
|
|
<div class="args" id="<?= esc($argsId, 'attr') ?>">
|
2022-03-04 14:33:48 +00:00
|
|
|
<table cellspacing="0">
|
|
|
|
|
|
|
|
<?php
|
2023-07-06 15:56:05 +00:00
|
|
|
$params = null;
|
2023-02-22 16:29:45 +00:00
|
|
|
// Reflection by name is not available for closure function
|
2024-04-26 09:26:22 +00:00
|
|
|
if (! str_ends_with($row['function'], '}')) {
|
2023-07-06 15:56:05 +00:00
|
|
|
$mirror = isset($row['class']) ? new ReflectionMethod($row['class'], $row['function']) : new ReflectionFunction($row['function']);
|
2023-02-22 16:29:45 +00:00
|
|
|
$params = $mirror->getParameters();
|
|
|
|
}
|
|
|
|
|
|
|
|
foreach ($row['args'] as $key => $value) : ?>
|
2022-03-04 14:33:48 +00:00
|
|
|
<tr>
|
|
|
|
<td><code><?= esc(isset($params[$key]) ? '$' . $params[$key]->name : "#{$key}") ?></code></td>
|
|
|
|
<td><pre><?= esc(print_r($value, true)) ?></pre></td>
|
|
|
|
</tr>
|
|
|
|
<?php endforeach ?>
|
|
|
|
|
|
|
|
</table>
|
|
|
|
</div>
|
|
|
|
<?php else : ?>
|
|
|
|
()
|
2021-04-02 17:20:02 +00:00
|
|
|
<?php endif; ?>
|
2022-03-04 14:33:48 +00:00
|
|
|
<?php endif; ?>
|
|
|
|
|
|
|
|
<?php if (! isset($row['class']) && isset($row['function'])) : ?>
|
|
|
|
— <?= esc($row['function']) ?>()
|
|
|
|
<?php endif; ?>
|
|
|
|
</p>
|
2021-05-06 14:00:48 +00:00
|
|
|
|
2022-03-04 14:33:48 +00:00
|
|
|
<!-- Source? -->
|
|
|
|
<?php if (isset($row['file']) && is_file($row['file']) && isset($row['class'])) : ?>
|
|
|
|
<div class="source">
|
|
|
|
<?= static::highlightFile($row['file'], $row['line']) ?>
|
2021-04-02 17:20:02 +00:00
|
|
|
</div>
|
|
|
|
<?php endif; ?>
|
2022-03-04 14:33:48 +00:00
|
|
|
</li>
|
|
|
|
|
|
|
|
<?php endforeach; ?>
|
2021-04-02 17:20:02 +00:00
|
|
|
</ol>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<!-- Server -->
|
|
|
|
<div class="content" id="server">
|
2022-03-04 14:33:48 +00:00
|
|
|
<?php foreach (['_SERVER', '_SESSION'] as $var) : ?>
|
|
|
|
<?php
|
|
|
|
if (empty($GLOBALS[$var]) || ! is_array($GLOBALS[$var])) {
|
|
|
|
continue;
|
|
|
|
} ?>
|
2021-04-02 17:20:02 +00:00
|
|
|
|
|
|
|
<h3>$<?= esc($var) ?></h3>
|
|
|
|
|
|
|
|
<table>
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th>Key</th>
|
|
|
|
<th>Value</th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
2022-03-04 14:33:48 +00:00
|
|
|
<?php foreach ($GLOBALS[$var] as $key => $value) : ?>
|
|
|
|
<tr>
|
|
|
|
<td><?= esc($key) ?></td>
|
|
|
|
<td>
|
|
|
|
<?php if (is_string($value)) : ?>
|
|
|
|
<?= esc($value) ?>
|
|
|
|
<?php else: ?>
|
|
|
|
<pre><?= esc(print_r($value, true)) ?></pre>
|
|
|
|
<?php endif; ?>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<?php endforeach; ?>
|
2021-04-02 17:20:02 +00:00
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
|
2022-03-04 14:33:48 +00:00
|
|
|
<?php endforeach ?>
|
2021-04-02 17:20:02 +00:00
|
|
|
|
|
|
|
<!-- Constants -->
|
|
|
|
<?php $constants = get_defined_constants(true); ?>
|
2022-03-04 14:33:48 +00:00
|
|
|
<?php if (! empty($constants['user'])) : ?>
|
2021-04-02 17:20:02 +00:00
|
|
|
<h3>Constants</h3>
|
|
|
|
|
|
|
|
<table>
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th>Key</th>
|
|
|
|
<th>Value</th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
2022-03-04 14:33:48 +00:00
|
|
|
<?php foreach ($constants['user'] as $key => $value) : ?>
|
|
|
|
<tr>
|
|
|
|
<td><?= esc($key) ?></td>
|
|
|
|
<td>
|
|
|
|
<?php if (is_string($value)) : ?>
|
|
|
|
<?= esc($value) ?>
|
|
|
|
<?php else: ?>
|
|
|
|
<pre><?= esc(print_r($value, true)) ?></pre>
|
|
|
|
<?php endif; ?>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<?php endforeach; ?>
|
2021-04-02 17:20:02 +00:00
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
<?php endif; ?>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<!-- Request -->
|
|
|
|
<div class="content" id="request">
|
2023-07-06 15:56:05 +00:00
|
|
|
<?php $request = Services::request(); ?>
|
2021-04-02 17:20:02 +00:00
|
|
|
|
|
|
|
<table>
|
|
|
|
<tbody>
|
|
|
|
<tr>
|
|
|
|
<td style="width: 10em">Path</td>
|
2022-01-04 15:40:27 +00:00
|
|
|
<td><?= esc($request->getUri()) ?></td>
|
2021-04-02 17:20:02 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>HTTP Method</td>
|
2024-04-26 09:26:22 +00:00
|
|
|
<td><?= esc($request->getMethod()) ?></td>
|
2021-04-02 17:20:02 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>IP Address</td>
|
|
|
|
<td><?= esc($request->getIPAddress()) ?></td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td style="width: 10em">Is AJAX Request?</td>
|
|
|
|
<td><?= $request->isAJAX() ? 'yes' : 'no' ?></td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>Is CLI Request?</td>
|
|
|
|
<td><?= $request->isCLI() ? 'yes' : 'no' ?></td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>Is Secure Request?</td>
|
|
|
|
<td><?= $request->isSecure() ? 'yes' : 'no' ?></td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>User Agent</td>
|
|
|
|
<td><?= esc($request->getUserAgent()->getAgentString()) ?></td>
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
|
|
|
|
|
|
|
|
<?php $empty = true; ?>
|
2022-03-04 14:33:48 +00:00
|
|
|
<?php foreach (['_GET', '_POST', '_COOKIE'] as $var) : ?>
|
|
|
|
<?php
|
|
|
|
if (empty($GLOBALS[$var]) || ! is_array($GLOBALS[$var])) {
|
|
|
|
continue;
|
|
|
|
} ?>
|
2021-04-02 17:20:02 +00:00
|
|
|
|
|
|
|
<?php $empty = false; ?>
|
|
|
|
|
|
|
|
<h3>$<?= esc($var) ?></h3>
|
|
|
|
|
|
|
|
<table style="width: 100%">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th>Key</th>
|
|
|
|
<th>Value</th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
2022-03-04 14:33:48 +00:00
|
|
|
<?php foreach ($GLOBALS[$var] as $key => $value) : ?>
|
|
|
|
<tr>
|
|
|
|
<td><?= esc($key) ?></td>
|
|
|
|
<td>
|
|
|
|
<?php if (is_string($value)) : ?>
|
|
|
|
<?= esc($value) ?>
|
|
|
|
<?php else: ?>
|
|
|
|
<pre><?= esc(print_r($value, true)) ?></pre>
|
|
|
|
<?php endif; ?>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<?php endforeach; ?>
|
2021-04-02 17:20:02 +00:00
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
|
2022-03-04 14:33:48 +00:00
|
|
|
<?php endforeach ?>
|
2021-04-02 17:20:02 +00:00
|
|
|
|
2022-03-04 14:33:48 +00:00
|
|
|
<?php if ($empty) : ?>
|
2021-04-02 17:20:02 +00:00
|
|
|
|
|
|
|
<div class="alert">
|
|
|
|
No $_GET, $_POST, or $_COOKIE Information to show.
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<?php endif; ?>
|
|
|
|
|
2022-08-01 10:13:16 +00:00
|
|
|
<?php $headers = $request->headers(); ?>
|
2022-03-04 14:33:48 +00:00
|
|
|
<?php if (! empty($headers)) : ?>
|
2021-04-02 17:20:02 +00:00
|
|
|
|
|
|
|
<h3>Headers</h3>
|
|
|
|
|
|
|
|
<table>
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th>Header</th>
|
|
|
|
<th>Value</th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
2024-04-26 09:26:22 +00:00
|
|
|
<?php foreach ($headers as $name => $value) : ?>
|
|
|
|
<tr>
|
|
|
|
<td><?= esc($name, 'html') ?></td>
|
|
|
|
<td>
|
|
|
|
<?php
|
|
|
|
if ($value instanceof Header) {
|
|
|
|
echo esc($value->getValueLine(), 'html');
|
|
|
|
} else {
|
|
|
|
foreach ($value as $i => $header) {
|
|
|
|
echo ' (' . $i + 1 . ') ' . esc($header->getValueLine(), 'html');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<?php endforeach; ?>
|
2021-04-02 17:20:02 +00:00
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
|
|
|
|
<?php endif; ?>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<!-- Response -->
|
|
|
|
<?php
|
2023-07-06 15:56:05 +00:00
|
|
|
$response = Services::response();
|
2023-02-22 16:29:45 +00:00
|
|
|
$response->setStatusCode(http_response_code());
|
|
|
|
?>
|
2021-04-02 17:20:02 +00:00
|
|
|
<div class="content" id="response">
|
|
|
|
<table>
|
|
|
|
<tr>
|
|
|
|
<td style="width: 15em">Response Status</td>
|
2022-06-13 16:30:34 +00:00
|
|
|
<td><?= esc($response->getStatusCode() . ' - ' . $response->getReasonPhrase()) ?></td>
|
2021-04-02 17:20:02 +00:00
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
|
2022-08-01 10:13:16 +00:00
|
|
|
<?php $headers = $response->headers(); ?>
|
2022-03-04 14:33:48 +00:00
|
|
|
<?php if (! empty($headers)) : ?>
|
2021-04-02 17:20:02 +00:00
|
|
|
<h3>Headers</h3>
|
|
|
|
|
|
|
|
<table>
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th>Header</th>
|
|
|
|
<th>Value</th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
2024-04-26 09:26:22 +00:00
|
|
|
<?php foreach ($headers as $name => $value) : ?>
|
2023-07-06 15:56:05 +00:00
|
|
|
<tr>
|
|
|
|
<td><?= esc($name, 'html') ?></td>
|
2024-04-26 09:26:22 +00:00
|
|
|
<td>
|
|
|
|
<?php
|
|
|
|
if ($value instanceof Header) {
|
|
|
|
echo esc($response->getHeaderLine($name), 'html');
|
|
|
|
} else {
|
|
|
|
foreach ($value as $i => $header) {
|
|
|
|
echo ' (' . $i + 1 . ') ' . esc($header->getValueLine(), 'html');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
</td>
|
2023-07-06 15:56:05 +00:00
|
|
|
</tr>
|
2024-04-26 09:26:22 +00:00
|
|
|
<?php endforeach; ?>
|
2021-04-02 17:20:02 +00:00
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
|
|
|
|
<?php endif; ?>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<!-- Files -->
|
|
|
|
<div class="content" id="files">
|
|
|
|
<?php $files = get_included_files(); ?>
|
|
|
|
|
|
|
|
<ol>
|
2022-03-04 14:33:48 +00:00
|
|
|
<?php foreach ($files as $file) :?>
|
2022-06-13 16:30:34 +00:00
|
|
|
<li><?= esc(clean_path($file)) ?></li>
|
2022-03-04 14:33:48 +00:00
|
|
|
<?php endforeach ?>
|
2021-04-02 17:20:02 +00:00
|
|
|
</ol>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<!-- Memory -->
|
|
|
|
<div class="content" id="memory">
|
|
|
|
|
|
|
|
<table>
|
|
|
|
<tbody>
|
|
|
|
<tr>
|
|
|
|
<td>Memory Usage</td>
|
|
|
|
<td><?= esc(static::describeMemory(memory_get_usage(true))) ?></td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td style="width: 12em">Peak Memory Usage:</td>
|
|
|
|
<td><?= esc(static::describeMemory(memory_get_peak_usage(true))) ?></td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>Memory Limit:</td>
|
|
|
|
<td><?= esc(ini_get('memory_limit')) ?></td>
|
|
|
|
</tr>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
2021-05-06 14:00:48 +00:00
|
|
|
</div> <!-- /tab-content -->
|
2021-04-02 17:20:02 +00:00
|
|
|
|
|
|
|
</div> <!-- /container -->
|
2023-11-15 16:17:43 +00:00
|
|
|
<?php endif; ?>
|
2021-04-02 17:20:02 +00:00
|
|
|
|
2020-05-27 18:46:16 +02:00
|
|
|
</body>
|
2021-05-06 14:00:48 +00:00
|
|
|
</html>
|