Answer the question
In order to leave comments, you need to log in
How to redirect to the 500.php page?
How do I redirect to the 500.php page so that the .htaccess ErrorDocument 500 /500.php
rule will work ?
The code below works without including the header:
<?php
ini_set('display_errors', 0);
throw new Error('Error!');
require($_SERVER["DOCUMENT_ROOT"]."/bitrix/header.php");
'exception_handling' =>
array (
'value' =>
array (
'debug' => false,
'handled_errors_types' => 4437,
'exception_errors_types' => 4437,
'ignore_silence' => false,
'assertion_throws_exception' => true,
'assertion_error_type' => 256,
'log' => NULL,
),
'readonly' => false,
),
Answer the question
In order to leave comments, you need to log in
With a friend found that in Bitrix\Main\Diag\ExceptionHandler
is called set_exception_handler(function () {})
.
Starting from ExceptionHandler in init.php indicated the following:
if (!Bitrix\Main\Config\Configuration::getValue('exception_handling')['debug']) { // если 'exception_handling' => ['value' => ['debug' => false]]
set_exception_handler(function ($exception) {
(new Bitrix\Main\Diag\ExceptionHandler())->writeToLog($exception, Bitrix\Main\Diag\ExceptionHandlerLog::UNCAUGHT_EXCEPTION); // логируем
LocalRedirect('/500.php');
exit;
});
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question