run(); } catch (\Throwable $exception) { $safeDetail = $stage === 'configuration' && $exception instanceof \InvalidArgumentException ? $exception->getMessage() : 'Check dependencies and application bootstrap at ' . $exception->getFile() . ':' . $exception->getLine(); error_log((string) json_encode([ 'message' => 'Application bootstrap failed', 'stage' => $stage, 'detail' => $safeDetail, 'exception_type' => $exception::class, ], JSON_UNESCAPED_SLASHES | JSON_INVALID_UTF8_SUBSTITUTE)); http_response_code(500); header('Content-Type: text/html; charset=utf-8'); echo '
' . htmlspecialchars($safeDetail, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8') . ''; } echo ''; }