diff --git a/phpBB/includes/acp/acp_extensions.php b/phpBB/includes/acp/acp_extensions.php index e08c2e341b..626f1b09c1 100644 --- a/phpBB/includes/acp/acp_extensions.php +++ b/phpBB/includes/acp/acp_extensions.php @@ -276,6 +276,12 @@ class acp_extensions { $this->template->assign_var('MIGRATOR_ERROR', $e->getLocalisedMessage($this->user)); } + catch (\Exception $e) + { + $stack_trace = phpbb_filter_root_path(str_replace("\n", '
', $e->getTraceAsString())); + $message = $e->getMessage(); + $this->template->assign_var('MIGRATOR_ERROR', '' . $message . '

' . $stack_trace); + } $this->tpl_name = 'acp_ext_enable'; diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index f725d5f996..72241b52f0 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -2716,7 +2716,7 @@ function get_backtrace() // Only show function arguments for include etc. // Other parameters may contain sensible information $argument = ''; - if (!empty($trace['args'][0]) && in_array($trace['function'], array('include', 'require', 'include_once', 'require_once'))) + if (!empty($trace['args'][0]) && in_array($trace['function'], array('include', 'require', 'include_once', 'require_once', 'try_apply'))) { $argument = htmlspecialchars(phpbb_filter_root_path($trace['args'][0]), ENT_COMPAT); } diff --git a/phpBB/install/startup.php b/phpBB/install/startup.php index b8ceb37342..0cff634795 100644 --- a/phpBB/install/startup.php +++ b/phpBB/install/startup.php @@ -107,7 +107,7 @@ function installer_msg_handler($errno, $msg_text, $errfile, $errline): bool { /** @var \phpbb\install\helper\iohandler\iohandler_interface $iohandler */ $iohandler = $phpbb_installer_container->get('installer.helper.iohandler'); - $iohandler->add_error_message($msg); + $iohandler->add_error_message($msg, get_backtrace()); $iohandler->send_response(true); exit(); } diff --git a/phpBB/phpbb/db/tools/doctrine.php b/phpBB/phpbb/db/tools/doctrine.php index aaf44aed68..65fd6b39aa 100644 --- a/phpBB/phpbb/db/tools/doctrine.php +++ b/phpBB/phpbb/db/tools/doctrine.php @@ -458,34 +458,26 @@ class doctrine implements tools_interface */ protected function alter_schema(callable $callback) { - try + $current_schema = $this->get_schema(); + $new_schema = clone $current_schema; + call_user_func($callback, $new_schema); + + $comparator = new comparator(); + $schemaDiff = $comparator->compareSchemas($current_schema, $new_schema); + $queries = $schemaDiff->toSql($this->get_schema_manager()->getDatabasePlatform()); + + if ($this->return_statements) { - $current_schema = $this->get_schema(); - $new_schema = clone $current_schema; - call_user_func($callback, $new_schema); - - $comparator = new comparator(); - $schemaDiff = $comparator->compareSchemas($current_schema, $new_schema); - $queries = $schemaDiff->toSql($this->get_schema_manager()->getDatabasePlatform()); - - if ($this->return_statements) - { - return $queries; - } - - foreach ($queries as $query) - { - // executeQuery() must be used here because $query might return a result set, for instance REPAIR does - $this->connection->executeQuery($query); - } - - return true; + return $queries; } - catch (Exception $e) + + foreach ($queries as $query) { - // @todo: check if it makes sense to properly handle the exception - return [$e->getMessage()]; + // executeQuery() must be used here because $query might return a result set, for instance REPAIR does + $this->connection->executeQuery($query); } + + return true; } /** diff --git a/phpBB/phpbb/install/installer.php b/phpBB/phpbb/install/installer.php index 23ab5df919..3664b39f2d 100644 --- a/phpBB/phpbb/install/installer.php +++ b/phpBB/phpbb/install/installer.php @@ -280,7 +280,9 @@ class installer } catch (\Exception $e) { - $this->iohandler->add_error_message($e->getMessage()); + $stack_trace = phpbb_filter_root_path(str_replace("\n", '
', $e->getTraceAsString())); + $message = $e->getMessage(); + $this->iohandler->add_error_message($message, $stack_trace); $this->iohandler->send_response(true); $fail_cleanup = true; }