Twig\Error\RuntimeError {#1904 -lineno: 40 -name: "@WebProfiler/Profiler/layout.html.twig" -rawMessage: "An exception has been thrown during the rendering of a template ("Notice: SessionHandler::gc(): ps_files_cleanup_dir: opendir(/var/lib/php/sessions) failed: Permission denied (13)")." -sourcePath: "/var/www/83/bmwcsee-followup-mailer/vendor/symfony/web-profiler-bundle/Resources/views/Profiler/layout.html.twig" -sourceCode: """ {% extends '@WebProfiler/Profiler/base.html.twig' %}\n \n {% block body %}\n <div class="container">\n {{ include('@WebProfiler/Profiler/header.html.twig', {profile_type: profile_type}, with_context = false) }}\n \n <div id="summary">\n {% block summary %}\n {% if profile is defined %}\n {% set request_collector = profile.collectors.request|default(false) %}\n \n {{ include('@WebProfiler/Profiler/_%s_summary.html.twig'|format(profile_type), {\n profile: profile,\n command_collector: profile.collectors.command|default(false) ,\n request_collector: request_collector,\n request: request,\n token: token\n }, with_context=false) }}\n {% endif %}\n {% endblock %}\n </div>\n \n <div id="content">\n <div id="main">\n <div id="sidebar">\n {% block sidebar %}\n <div id="sidebar-contents">\n <div id="sidebar-shortcuts">\n {% block sidebar_shortcuts_links %}\n <div class="shortcuts">\n <a class="btn btn-link" href="{{ path('_profiler_search', { limit: 10, type: profile_type }) }}">Last 10</a>\n <a class="btn btn-link" href="{{ path('_profiler', { token: 'latest', type: profile_type }|merge(request.query.all)) }}">Latest</a>\n \n <a class="sf-toggle btn btn-link" data-toggle-selector="#sidebar-search" {% if tokens is defined or about is defined %}data-toggle-initial="display"{% endif %}>\n {{ source('@WebProfiler/Icon/search.svg') }} <span class="hidden-small">Search</span>\n </a>\n </div>\n {% endblock sidebar_shortcuts_links %}\n \n {{ render(controller('web_profiler.controller.profiler::searchBarAction', query={type: profile_type }|merge(request.query.all))) }}\n </div>\n \n {% if templates is defined %}\n <ul id="menu-profiler">\n {% if 'request' is same as(profile_type) %}\n {% set excludes = ['command'] %}\n {% elseif 'command' is same as(profile_type) %}\n {% set excludes = ['request', 'router'] %}\n {% endif %}\n \n {% for name, template in templates|filter((t, n) => n not in excludes) %}\n {% set menu -%}\n {%- if block('menu', template) is defined -%}\n {% with { collector: profile.getcollector(name), profiler_markup_version: profiler_markup_version } %}\n {{- block('menu', template) -}}\n {% endwith %}\n {%- endif -%}\n {%- endset %}\n {% if menu is not empty %}\n <li class="{{ name }} {{ name == panel ? 'selected' }}">\n <a href="{{ path('_profiler', { token: token, panel: name, type: profile_type }) }}">{{ menu|raw }}</a>\n </li>\n {% endif %}\n {% endfor %}\n </ul>\n {% endif %}\n </div>\n \n {{ include('@WebProfiler/Profiler/settings.html.twig') }}\n {% endblock sidebar %}\n </div>\n \n <div id="collector-wrapper">\n <div id="collector-content">\n {{ include('@WebProfiler/Profiler/base_js.html.twig') }}\n {% block panel '' %}\n </div>\n </div>\n </div>\n </div>\n </div>\n {% endblock %}\n """ }
ErrorException {#1673 #severity: E_WARNING }
* @param int $line The selected line number
* @param int $srcContext The number of displayed lines around or -1 for the whole file
*/
private function fileExcerpt(string $file, int $line, int $srcContext = 3): string
{
if (is_file($file) && is_readable($file)) {
// highlight_file could throw warnings
// see https://bugs.php.net/25725
$code = @highlight_file($file, true);
if (\PHP_VERSION_ID >= 80300) {
// remove main pre/code tags
</span>
<?php } ?>
</div>
<?php if ($trace['file']) { ?>
<div id="trace-html-<?= $prefix.'-'.$i; ?>" class="trace-code sf-toggle-content">
<?= strtr($this->fileExcerpt($trace['file'], $trace['line'], 5), [
'var(--highlight-string)' => 'var(--highlight-string)',
'var(--highlight-keyword)' => 'var(--highlight-keyword)',
'var(--highlight-default)' => 'var(--highlight-default)',
'var(--highlight-comment)' => 'var(--highlight-comment)',
]); ?>
private function include(string $name, array $context = []): string
{
extract($context, \EXTR_SKIP);
ob_start();
include is_file(\dirname(__DIR__).'/Resources/'.$name) ? \dirname(__DIR__).'/Resources/'.$name : $name;
return trim(ob_get_clean());
}
/**
$displayCodeSnippet = $isFirstUserCode && !$isVendorTrace;
if ($displayCodeSnippet) {
$isFirstUserCode = false;
} ?>
<div class="trace-line <?= $isVendorTrace ? 'trace-from-vendor' : ''; ?>">
<?= $this->include('views/trace.html.php', [
'prefix' => $index,
'i' => $i,
'trace' => $trace,
'style' => $isVendorTrace ? 'compact' : ($displayCodeSnippet ? 'expanded' : ''),
]); ?>
private function include(string $name, array $context = []): string
{
extract($context, \EXTR_SKIP);
ob_start();
include is_file(\dirname(__DIR__).'/Resources/'.$name) ? \dirname(__DIR__).'/Resources/'.$name : $name;
return trim(ob_get_clean());
}
/**
</h3>
<div class="tab-content">
<?php
foreach ($exceptionAsArray as $i => $e) {
echo $this->include('views/traces.html.php', [
'exception' => $e,
'index' => $i + 1,
'expand' => in_array($i, $exceptionWithUserCode, true) || ([] === $exceptionWithUserCode && 0 === $i),
]);
}
private function include(string $name, array $context = []): string
{
extract($context, \EXTR_SKIP);
ob_start();
include is_file(\dirname(__DIR__).'/Resources/'.$name) ? \dirname(__DIR__).'/Resources/'.$name : $name;
return trim(ob_get_clean());
}
/**
</div>
</div>
</header>
<?php } ?>
<?= $this->include('views/exception.html.php', $context); ?>
<script>
<?= $this->include('assets/js/exception.js'); ?>
</script>
</body>
private function include(string $name, array $context = []): string
{
extract($context, \EXTR_SKIP);
ob_start();
include is_file(\dirname(__DIR__).'/Resources/'.$name) ? \dirname(__DIR__).'/Resources/'.$name : $name;
return trim(ob_get_clean());
}
/**
]);
}
$exceptionMessage = $this->escape($exception->getMessage());
return $this->include($debugTemplate, [
'exception' => $exception,
'exceptionMessage' => $exceptionMessage,
'statusText' => $statusText,
'statusCode' => $statusCode,
'logger' => null !== $this->logger && class_exists(DebugLoggerConfigurator::class) ? DebugLoggerConfigurator::getDebugLogger($this->logger) : null,
$headers['X-Debug-Exception-File'] = rawurlencode($exception->getFile()).':'.$exception->getLine();
}
$exception = FlattenException::createWithDataRepresentation($exception, null, $headers);
return $exception->setAsString($this->renderException($exception));
}
/**
* Gets the HTML content associated with the given exception.
*/
{
$flattenException = FlattenException::createFromThrowable($exception);
$debug = \is_bool($this->debug) ? $this->debug : ($this->debug)($flattenException);
if ($debug || !$template = $this->findTemplate($flattenException->getStatusCode())) {
return $this->fallbackErrorRenderer->render($exception);
}
return $flattenException->setAsString($this->twig->render($template, [
'exception' => $flattenException,
'status_code' => $flattenException->getStatusCode(),
$flattenException->setAsString($this->serializer->serialize($flattenException, $format, [
'exception' => $exception,
'debug' => $debug,
]));
} catch (NotEncodableValueException) {
$flattenException = $this->fallbackErrorRenderer->render($exception);
}
return $flattenException->setHeaders($flattenException->getHeaders() + $headers);
}
$this->errorRenderer = $errorRenderer;
}
public function __invoke(\Throwable $exception): Response
{
$exception = $this->errorRenderer->render($exception);
return new Response($exception->getAsString(), $exception->getStatusCode(), $exception->getHeaders());
}
public function preview(Request $request, int $code): Response
$this->dispatcher->dispatch($event, KernelEvents::CONTROLLER_ARGUMENTS);
$controller = $event->getController();
$arguments = $event->getArguments();
// call controller
$response = $controller(...$arguments);
// view
if (!$response instanceof Response) {
$event = new ViewEvent($this, $request, $type, $response, $event);
$this->dispatcher->dispatch($event, KernelEvents::VIEW);
$request->headers->set('X-Php-Ob-Level', (string) ob_get_level());
$this->requestStack->push($request);
$response = null;
try {
return $response = $this->handleRaw($request, $type);
} catch (\Throwable $e) {
if ($e instanceof \Error && !$this->handleAllThrowables) {
throw $e;
}
}
$request = $this->duplicateRequest($throwable, $event->getRequest());
try {
$response = $event->getKernel()->handle($request, HttpKernelInterface::SUB_REQUEST, false);
} catch (\Exception $e) {
$f = FlattenException::createFromThrowable($e);
$this->logException($e, sprintf('Exception thrown when handling an exception (%s: %s at %s line %s)', $f->getClass(), $f->getMessage(), basename($e->getFile()), $e->getLine()));
$this->priority ??= $dispatcher->getListenerPriority($eventName, $this->listener);
$e = $this->stopwatch->start($this->name, 'event_listener');
try {
($this->optimizedListener ?? $this->listener)($event, $eventName, $dispatcher);
} finally {
if ($e->isStarted()) {
$e->stop();
}
}
foreach ($listeners as $listener) {
if ($stoppable && $event->isPropagationStopped()) {
break;
}
$listener($event, $eventName, $this);
}
}
/**
* Sorts the internal list of listeners for the given event by priority.
} else {
$listeners = $this->getListeners($eventName);
}
if ($listeners) {
$this->callListeners($listeners, $eventName, $event);
}
return $event;
}
try {
$this->beforeDispatch($eventName, $event);
try {
$e = $this->stopwatch->start($eventName, 'section');
try {
$this->dispatcher->dispatch($event, $eventName);
} finally {
if ($e->isStarted()) {
$e->stop();
}
}
* Handles a throwable by trying to convert it to a Response.
*/
private function handleThrowable(\Throwable $e, Request $request, int $type): Response
{
$event = new ExceptionEvent($this, $request, $type, $e);
$this->dispatcher->dispatch($event, KernelEvents::EXCEPTION);
// a listener might have replaced the exception
$e = $event->getThrowable();
if (!$event->hasResponse()) {
$this->finishRequest($request, $type);
throw $e;
}
return $response = $this->handleThrowable($e, $request, $type);
} finally {
$this->requestStack->pop();
if ($response instanceof StreamedResponse && $callback = $response->getCallback()) {
$requestStack = $this->requestStack;
$this->boot();
++$this->requestStackSize;
$this->resetServices = true;
try {
return $this->getHttpKernel()->handle($request, $type, $catch);
} finally {
--$this->requestStackSize;
}
}
) {
}
public function run(): int
{
$response = $this->kernel->handle($this->request);
if (Kernel::VERSION_ID >= 60400) {
$response->send(false);
if (\function_exists('fastcgi_finish_request') && !$this->debug) {
$app = $app(...$args);
exit(
$runtime
->getRunner($app)
->run()
);
<?php
use App\Kernel;
require_once dirname(__DIR__).'/vendor/autoload_runtime.php';
ini_set('memory_limit', '256M');
ini_set('max_execution_time', '600');
return function (array $context) {
ErrorException {#1507 #severity: E_WARNING }
* @param int $line The selected line number
* @param int $srcContext The number of displayed lines around or -1 for the whole file
*/
private function fileExcerpt(string $file, int $line, int $srcContext = 3): string
{
if (is_file($file) && is_readable($file)) {
// highlight_file could throw warnings
// see https://bugs.php.net/25725
$code = @highlight_file($file, true);
if (\PHP_VERSION_ID >= 80300) {
// remove main pre/code tags
</span>
<?php } ?>
</div>
<?php if ($trace['file']) { ?>
<div id="trace-html-<?= $prefix.'-'.$i; ?>" class="trace-code sf-toggle-content">
<?= strtr($this->fileExcerpt($trace['file'], $trace['line'], 5), [
'var(--highlight-string)' => 'var(--highlight-string)',
'var(--highlight-keyword)' => 'var(--highlight-keyword)',
'var(--highlight-default)' => 'var(--highlight-default)',
'var(--highlight-comment)' => 'var(--highlight-comment)',
]); ?>
private function include(string $name, array $context = []): string
{
extract($context, \EXTR_SKIP);
ob_start();
include is_file(\dirname(__DIR__).'/Resources/'.$name) ? \dirname(__DIR__).'/Resources/'.$name : $name;
return trim(ob_get_clean());
}
/**
$displayCodeSnippet = $isFirstUserCode && !$isVendorTrace;
if ($displayCodeSnippet) {
$isFirstUserCode = false;
} ?>
<div class="trace-line <?= $isVendorTrace ? 'trace-from-vendor' : ''; ?>">
<?= $this->include('views/trace.html.php', [
'prefix' => $index,
'i' => $i,
'trace' => $trace,
'style' => $isVendorTrace ? 'compact' : ($displayCodeSnippet ? 'expanded' : ''),
]); ?>
private function include(string $name, array $context = []): string
{
extract($context, \EXTR_SKIP);
ob_start();
include is_file(\dirname(__DIR__).'/Resources/'.$name) ? \dirname(__DIR__).'/Resources/'.$name : $name;
return trim(ob_get_clean());
}
/**
</h3>
<div class="tab-content">
<?php
foreach ($exceptionAsArray as $i => $e) {
echo $this->include('views/traces.html.php', [
'exception' => $e,
'index' => $i + 1,
'expand' => in_array($i, $exceptionWithUserCode, true) || ([] === $exceptionWithUserCode && 0 === $i),
]);
}
private function include(string $name, array $context = []): string
{
extract($context, \EXTR_SKIP);
ob_start();
include is_file(\dirname(__DIR__).'/Resources/'.$name) ? \dirname(__DIR__).'/Resources/'.$name : $name;
return trim(ob_get_clean());
}
/**
</div>
</div>
</header>
<?php } ?>
<?= $this->include('views/exception.html.php', $context); ?>
<script>
<?= $this->include('assets/js/exception.js'); ?>
</script>
</body>
private function include(string $name, array $context = []): string
{
extract($context, \EXTR_SKIP);
ob_start();
include is_file(\dirname(__DIR__).'/Resources/'.$name) ? \dirname(__DIR__).'/Resources/'.$name : $name;
return trim(ob_get_clean());
}
/**
]);
}
$exceptionMessage = $this->escape($exception->getMessage());
return $this->include($debugTemplate, [
'exception' => $exception,
'exceptionMessage' => $exceptionMessage,
'statusText' => $statusText,
'statusCode' => $statusCode,
'logger' => null !== $this->logger && class_exists(DebugLoggerConfigurator::class) ? DebugLoggerConfigurator::getDebugLogger($this->logger) : null,
$headers['X-Debug-Exception-File'] = rawurlencode($exception->getFile()).':'.$exception->getLine();
}
$exception = FlattenException::createWithDataRepresentation($exception, null, $headers);
return $exception->setAsString($this->renderException($exception));
}
/**
* Gets the HTML content associated with the given exception.
*/
{
$flattenException = FlattenException::createFromThrowable($exception);
$debug = \is_bool($this->debug) ? $this->debug : ($this->debug)($flattenException);
if ($debug || !$template = $this->findTemplate($flattenException->getStatusCode())) {
return $this->fallbackErrorRenderer->render($exception);
}
return $flattenException->setAsString($this->twig->render($template, [
'exception' => $flattenException,
'status_code' => $flattenException->getStatusCode(),
$flattenException->setAsString($this->serializer->serialize($flattenException, $format, [
'exception' => $exception,
'debug' => $debug,
]));
} catch (NotEncodableValueException) {
$flattenException = $this->fallbackErrorRenderer->render($exception);
}
return $flattenException->setHeaders($flattenException->getHeaders() + $headers);
}
$this->errorRenderer = $errorRenderer;
}
public function __invoke(\Throwable $exception): Response
{
$exception = $this->errorRenderer->render($exception);
return new Response($exception->getAsString(), $exception->getStatusCode(), $exception->getHeaders());
}
public function preview(Request $request, int $code): Response
$this->dispatcher->dispatch($event, KernelEvents::CONTROLLER_ARGUMENTS);
$controller = $event->getController();
$arguments = $event->getArguments();
// call controller
$response = $controller(...$arguments);
// view
if (!$response instanceof Response) {
$event = new ViewEvent($this, $request, $type, $response, $event);
$this->dispatcher->dispatch($event, KernelEvents::VIEW);
$request->headers->set('X-Php-Ob-Level', (string) ob_get_level());
$this->requestStack->push($request);
$response = null;
try {
return $response = $this->handleRaw($request, $type);
} catch (\Throwable $e) {
if ($e instanceof \Error && !$this->handleAllThrowables) {
throw $e;
}
}
$request = $this->duplicateRequest($throwable, $event->getRequest());
try {
$response = $event->getKernel()->handle($request, HttpKernelInterface::SUB_REQUEST, false);
} catch (\Exception $e) {
$f = FlattenException::createFromThrowable($e);
$this->logException($e, sprintf('Exception thrown when handling an exception (%s: %s at %s line %s)', $f->getClass(), $f->getMessage(), basename($e->getFile()), $e->getLine()));
$this->priority ??= $dispatcher->getListenerPriority($eventName, $this->listener);
$e = $this->stopwatch->start($this->name, 'event_listener');
try {
($this->optimizedListener ?? $this->listener)($event, $eventName, $dispatcher);
} finally {
if ($e->isStarted()) {
$e->stop();
}
}
foreach ($listeners as $listener) {
if ($stoppable && $event->isPropagationStopped()) {
break;
}
$listener($event, $eventName, $this);
}
}
/**
* Sorts the internal list of listeners for the given event by priority.
} else {
$listeners = $this->getListeners($eventName);
}
if ($listeners) {
$this->callListeners($listeners, $eventName, $event);
}
return $event;
}
try {
$this->beforeDispatch($eventName, $event);
try {
$e = $this->stopwatch->start($eventName, 'section');
try {
$this->dispatcher->dispatch($event, $eventName);
} finally {
if ($e->isStarted()) {
$e->stop();
}
}
* Handles a throwable by trying to convert it to a Response.
*/
private function handleThrowable(\Throwable $e, Request $request, int $type): Response
{
$event = new ExceptionEvent($this, $request, $type, $e);
$this->dispatcher->dispatch($event, KernelEvents::EXCEPTION);
// a listener might have replaced the exception
$e = $event->getThrowable();
if (!$event->hasResponse()) {
if ($pop = $request !== $this->requestStack->getMainRequest()) {
$this->requestStack->push($request);
}
try {
$response = $this->handleThrowable($exception, $request, self::MAIN_REQUEST);
} finally {
if ($pop) {
$this->requestStack->pop();
}
}
if ($hasRun) {
throw $e;
}
$hasRun = true;
$kernel->terminateWithException($e, $request);
};
}
} elseif ($event instanceof ConsoleEvent && $app = $event->getCommand()->getApplication()) {
$output = $event->getOutput();
if ($output instanceof ConsoleOutputInterface) {
$this->exceptionHandler = null;
}
try {
if (null !== $exceptionHandler) {
$exceptionHandler($exception);
return;
}
$handlerException ??= $exception;
} catch (\Throwable $handlerException) {
* @param int $line The selected line number
* @param int $srcContext The number of displayed lines around or -1 for the whole file
*/
private function fileExcerpt(string $file, int $line, int $srcContext = 3): string
{
if (is_file($file) && is_readable($file)) {
// highlight_file could throw warnings
// see https://bugs.php.net/25725
$code = @highlight_file($file, true);
if (\PHP_VERSION_ID >= 80300) {
// remove main pre/code tags
</span>
<?php } ?>
</div>
<?php if ($trace['file']) { ?>
<div id="trace-html-<?= $prefix.'-'.$i; ?>" class="trace-code sf-toggle-content">
<?= strtr($this->fileExcerpt($trace['file'], $trace['line'], 5), [
'var(--highlight-string)' => 'var(--highlight-string)',
'var(--highlight-keyword)' => 'var(--highlight-keyword)',
'var(--highlight-default)' => 'var(--highlight-default)',
'var(--highlight-comment)' => 'var(--highlight-comment)',
]); ?>
private function include(string $name, array $context = []): string
{
extract($context, \EXTR_SKIP);
ob_start();
include is_file(\dirname(__DIR__).'/Resources/'.$name) ? \dirname(__DIR__).'/Resources/'.$name : $name;
return trim(ob_get_clean());
}
/**
$displayCodeSnippet = $isFirstUserCode && !$isVendorTrace;
if ($displayCodeSnippet) {
$isFirstUserCode = false;
} ?>
<div class="trace-line <?= $isVendorTrace ? 'trace-from-vendor' : ''; ?>">
<?= $this->include('views/trace.html.php', [
'prefix' => $index,
'i' => $i,
'trace' => $trace,
'style' => $isVendorTrace ? 'compact' : ($displayCodeSnippet ? 'expanded' : ''),
]); ?>
private function include(string $name, array $context = []): string
{
extract($context, \EXTR_SKIP);
ob_start();
include is_file(\dirname(__DIR__).'/Resources/'.$name) ? \dirname(__DIR__).'/Resources/'.$name : $name;
return trim(ob_get_clean());
}
/**
</h3>
<div class="tab-content">
<?php
foreach ($exceptionAsArray as $i => $e) {
echo $this->include('views/traces.html.php', [
'exception' => $e,
'index' => $i + 1,
'expand' => in_array($i, $exceptionWithUserCode, true) || ([] === $exceptionWithUserCode && 0 === $i),
]);
}
private function include(string $name, array $context = []): string
{
extract($context, \EXTR_SKIP);
ob_start();
include is_file(\dirname(__DIR__).'/Resources/'.$name) ? \dirname(__DIR__).'/Resources/'.$name : $name;
return trim(ob_get_clean());
}
/**
</div>
</div>
</header>
<?php } ?>
<?= $this->include('views/exception.html.php', $context); ?>
<script>
<?= $this->include('assets/js/exception.js'); ?>
</script>
</body>
private function include(string $name, array $context = []): string
{
extract($context, \EXTR_SKIP);
ob_start();
include is_file(\dirname(__DIR__).'/Resources/'.$name) ? \dirname(__DIR__).'/Resources/'.$name : $name;
return trim(ob_get_clean());
}
/**
]);
}
$exceptionMessage = $this->escape($exception->getMessage());
return $this->include($debugTemplate, [
'exception' => $exception,
'exceptionMessage' => $exceptionMessage,
'statusText' => $statusText,
'statusCode' => $statusCode,
'logger' => null !== $this->logger && class_exists(DebugLoggerConfigurator::class) ? DebugLoggerConfigurator::getDebugLogger($this->logger) : null,
$headers['X-Debug-Exception-File'] = rawurlencode($exception->getFile()).':'.$exception->getLine();
}
$exception = FlattenException::createWithDataRepresentation($exception, null, $headers);
return $exception->setAsString($this->renderException($exception));
}
/**
* Gets the HTML content associated with the given exception.
*/
{
$flattenException = FlattenException::createFromThrowable($exception);
$debug = \is_bool($this->debug) ? $this->debug : ($this->debug)($flattenException);
if ($debug || !$template = $this->findTemplate($flattenException->getStatusCode())) {
return $this->fallbackErrorRenderer->render($exception);
}
return $flattenException->setAsString($this->twig->render($template, [
'exception' => $flattenException,
'status_code' => $flattenException->getStatusCode(),
$flattenException->setAsString($this->serializer->serialize($flattenException, $format, [
'exception' => $exception,
'debug' => $debug,
]));
} catch (NotEncodableValueException) {
$flattenException = $this->fallbackErrorRenderer->render($exception);
}
return $flattenException->setHeaders($flattenException->getHeaders() + $headers);
}
$this->errorRenderer = $errorRenderer;
}
public function __invoke(\Throwable $exception): Response
{
$exception = $this->errorRenderer->render($exception);
return new Response($exception->getAsString(), $exception->getStatusCode(), $exception->getHeaders());
}
public function preview(Request $request, int $code): Response
$this->dispatcher->dispatch($event, KernelEvents::CONTROLLER_ARGUMENTS);
$controller = $event->getController();
$arguments = $event->getArguments();
// call controller
$response = $controller(...$arguments);
// view
if (!$response instanceof Response) {
$event = new ViewEvent($this, $request, $type, $response, $event);
$this->dispatcher->dispatch($event, KernelEvents::VIEW);
$request->headers->set('X-Php-Ob-Level', (string) ob_get_level());
$this->requestStack->push($request);
$response = null;
try {
return $response = $this->handleRaw($request, $type);
} catch (\Throwable $e) {
if ($e instanceof \Error && !$this->handleAllThrowables) {
throw $e;
}
}
$request = $this->duplicateRequest($throwable, $event->getRequest());
try {
$response = $event->getKernel()->handle($request, HttpKernelInterface::SUB_REQUEST, false);
} catch (\Exception $e) {
$f = FlattenException::createFromThrowable($e);
$this->logException($e, sprintf('Exception thrown when handling an exception (%s: %s at %s line %s)', $f->getClass(), $f->getMessage(), basename($e->getFile()), $e->getLine()));
$this->priority ??= $dispatcher->getListenerPriority($eventName, $this->listener);
$e = $this->stopwatch->start($this->name, 'event_listener');
try {
($this->optimizedListener ?? $this->listener)($event, $eventName, $dispatcher);
} finally {
if ($e->isStarted()) {
$e->stop();
}
}
foreach ($listeners as $listener) {
if ($stoppable && $event->isPropagationStopped()) {
break;
}
$listener($event, $eventName, $this);
}
}
/**
* Sorts the internal list of listeners for the given event by priority.
} else {
$listeners = $this->getListeners($eventName);
}
if ($listeners) {
$this->callListeners($listeners, $eventName, $event);
}
return $event;
}
try {
$this->beforeDispatch($eventName, $event);
try {
$e = $this->stopwatch->start($eventName, 'section');
try {
$this->dispatcher->dispatch($event, $eventName);
} finally {
if ($e->isStarted()) {
$e->stop();
}
}
* Handles a throwable by trying to convert it to a Response.
*/
private function handleThrowable(\Throwable $e, Request $request, int $type): Response
{
$event = new ExceptionEvent($this, $request, $type, $e);
$this->dispatcher->dispatch($event, KernelEvents::EXCEPTION);
// a listener might have replaced the exception
$e = $event->getThrowable();
if (!$event->hasResponse()) {
$this->finishRequest($request, $type);
throw $e;
}
return $response = $this->handleThrowable($e, $request, $type);
} finally {
$this->requestStack->pop();
if ($response instanceof StreamedResponse && $callback = $response->getCallback()) {
$requestStack = $this->requestStack;
$this->boot();
++$this->requestStackSize;
$this->resetServices = true;
try {
return $this->getHttpKernel()->handle($request, $type, $catch);
} finally {
--$this->requestStackSize;
}
}
) {
}
public function run(): int
{
$response = $this->kernel->handle($this->request);
if (Kernel::VERSION_ID >= 60400) {
$response->send(false);
if (\function_exists('fastcgi_finish_request') && !$this->debug) {
$app = $app(...$args);
exit(
$runtime
->getRunner($app)
->run()
);
<?php
use App\Kernel;
require_once dirname(__DIR__).'/vendor/autoload_runtime.php';
ini_set('memory_limit', '256M');
ini_set('max_execution_time', '600');
return function (array $context) {