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