From 60f3c8a5ef4d675c726f62f9002b6f564f24e8b1 Mon Sep 17 00:00:00 2001 From: Denis Brumann Date: Sat, 22 Feb 2020 11:13:50 +0100 Subject: [PATCH] Adds exception template variable available in custom error pages --- components/error_handler.rst | 2 ++ controller/error_pages.rst | 11 +++++++++++ 2 files changed, 13 insertions(+) diff --git a/components/error_handler.rst b/components/error_handler.rst index fe5afd0af1b..ef4fded3cee 100644 --- a/components/error_handler.rst +++ b/components/error_handler.rst @@ -43,6 +43,8 @@ enable each of them separately. You should never enable the debug tools, except for the error handler, in a production environment as they might disclose sensitive information to the user. +.. _turning-php-errors-into-exceptions: + Turning PHP Errors into Exceptions ---------------------------------- diff --git a/controller/error_pages.rst b/controller/error_pages.rst index f713b909035..3f9f6550e84 100644 --- a/controller/error_pages.rst +++ b/controller/error_pages.rst @@ -118,6 +118,17 @@ store the HTTP status code and message respectively. and its required ``getStatusCode()`` method. Otherwise, the ``status_code`` will default to ``500``. +Additionally you have access to the Exception with ``exception``, which for example +allows you to output the stack trace using ``{{ exception.traceAsString }}`` or +access any other method on the object. You should be careful with this though, +as this is very likely to expose sensitive data. + +.. tip:: + + PHP errors are turned into exceptions as well by default, so you can also access these + error details using ``exception``. For more on this see + :ref:`Turning PHP Errors into Exceptions ` + Security & 404 Pages --------------------