fix 500 happening in error pages (#914)
This commit is contained in:
@@ -23,7 +23,7 @@ final class ThemeEvent extends Event
|
|||||||
public const CONTENT_AFTER = 'app.theme.content_after';
|
public const CONTENT_AFTER = 'app.theme.content_after';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var User
|
* @var User|null
|
||||||
*/
|
*/
|
||||||
protected $user;
|
protected $user;
|
||||||
/**
|
/**
|
||||||
@@ -35,33 +35,28 @@ final class ThemeEvent extends Event
|
|||||||
*/
|
*/
|
||||||
protected $payload = null;
|
protected $payload = null;
|
||||||
|
|
||||||
public function __construct(User $user, $payload = null)
|
public function __construct(?User $user = null, $payload = null)
|
||||||
{
|
{
|
||||||
$this->user = $user;
|
$this->user = $user;
|
||||||
$this->payload = $payload;
|
$this->payload = $payload;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return User
|
* @deprecated since 1.0
|
||||||
*/
|
*/
|
||||||
public function getUser()
|
public function getUser(): ?User
|
||||||
{
|
{
|
||||||
|
@trigger_error('Using ThemeEvent::getUser() is deprecated and will be removed with 2.0', E_USER_DEPRECATED);
|
||||||
|
|
||||||
return $this->user;
|
return $this->user;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getContent(): string
|
public function getContent(): string
|
||||||
{
|
{
|
||||||
return $this->content;
|
return $this->content;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function addContent(string $content): ThemeEvent
|
||||||
* @param string $content
|
|
||||||
* @return ThemeEvent
|
|
||||||
*/
|
|
||||||
public function addContent(string $content)
|
|
||||||
{
|
{
|
||||||
$this->content .= $content;
|
$this->content .= $content;
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,7 @@
|
|||||||
{#
|
{% extends 'error.html.twig' %}
|
||||||
This template is used to render errors of type HTTP 500 (Internal Server Error)
|
|
||||||
|
|
||||||
This is the simplest way to customize error pages in Symfony applications.
|
{% block error_icon %}
|
||||||
In case you need it, you can also hook into the internal exception handling
|
<i class="fas fa-bug text-red"></i>
|
||||||
made by Symfony. This allows you to perform advanced tasks and even recover
|
{% endblock %}
|
||||||
your application from some errors.
|
|
||||||
See http://symfony.com/doc/current/cookbook/controller/error_pages.html
|
{% block error_class %}text-red{% endblock %}
|
||||||
#}
|
|
||||||
{% extends '@Twig/Exception/error.html.twig' %}
|
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<div class="error-page">
|
<div class="error-page">
|
||||||
<h2 class="headline text-yellow"> {{ status_code }}</h2>
|
<h2 class="headline {% block error_class %}text-yellow{% endblock %}"> {{ status_code }}</h2>
|
||||||
|
|
||||||
{% block error_content %}
|
{% block error_content %}
|
||||||
<div class="error-content">
|
<div class="error-content">
|
||||||
|
|||||||
Reference in New Issue
Block a user