From 4a0a3d6a0fa07f46d499b34d0f9fc50102d3715a Mon Sep 17 00:00:00 2001 From: Rich Lott / Artful Robot Date: Mon, 31 Jul 2023 11:33:16 +0100 Subject: [PATCH] standalone: error handler: only backtrace if configured --- setup/res/index.php.txt | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/setup/res/index.php.txt b/setup/res/index.php.txt index aea3a5a585..66c7cf885b 100644 --- a/setup/res/index.php.txt +++ b/setup/res/index.php.txt @@ -74,12 +74,16 @@ function standaloneErrorHandler( if ($handlingError) { throw new \RuntimeException("Died: error was thrown during error handling"); } - $handlingError = TRUE; + $config = CRM_Core_Config::singleton(); + if (!$config->debug) { + // For these errors to show, we must be debugging. + return; + } + $handlingError = TRUE; $trace = ''; - // Might be nice to offer something like this to trace down errors. - $debug = CRM_Core_Config::singleton()->debug; - if ($debug) { + if ($config->backtrace) { + // Backtrace is configured for errors. $trace = []; foreach (array_slice(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS), 1) as $item) { $_ = ''; -- 2.25.1