From 62a45d86ec31ea4140ee188c115cdb779efa92ef Mon Sep 17 00:00:00 2001 From: Patrick Webster Date: Sun, 2 May 2021 16:29:31 -0500 Subject: [PATCH 1/2] [ticket/16292] Try to propagate serious errors to the installer UI Only raise a runtime exception during install/update as a last resort. PHPBB3-16292 --- phpBB/install/startup.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/phpBB/install/startup.php b/phpBB/install/startup.php index f3312d227d..381ef80141 100644 --- a/phpBB/install/startup.php +++ b/phpBB/install/startup.php @@ -93,7 +93,18 @@ function installer_msg_handler($errno, $msg_text, $errfile, $errline) case E_USER_ERROR: $msg = 'General Error:
' . $msg_text . '
in file ' . $errfile . ' on line ' . $errline . '

'; - throw new \phpbb\exception\runtime_exception($msg); + try + { + /** @var \phpbb\install\helper\iohandler\iohandler_interface $iohandler */ + $iohandler = $phpbb_installer_container->get('installer.helper.iohandler'); + $iohandler->add_error_message($msg); + $iohandler->send_response(true); + exit(); + } + catch (\phpbb\install\helper\iohandler\exception\iohandler_not_implemented_exception $e) + { + throw new \phpbb\exception\runtime_exception($msg); + } break; case E_DEPRECATED: return true; From e22f431660229785bce450414935f3858a623ba7 Mon Sep 17 00:00:00 2001 From: Patrick Webster Date: Mon, 3 May 2021 17:29:52 -0500 Subject: [PATCH 2/2] [ticket/16292] Check that the installer container is available PHPBB3-16292 --- phpBB/install/startup.php | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/phpBB/install/startup.php b/phpBB/install/startup.php index 381ef80141..0aaa9a648f 100644 --- a/phpBB/install/startup.php +++ b/phpBB/install/startup.php @@ -93,18 +93,22 @@ function installer_msg_handler($errno, $msg_text, $errfile, $errline) case E_USER_ERROR: $msg = 'General Error:
' . $msg_text . '
in file ' . $errfile . ' on line ' . $errline . '

'; - try + if (!empty($phpbb_installer_container)) { - /** @var \phpbb\install\helper\iohandler\iohandler_interface $iohandler */ - $iohandler = $phpbb_installer_container->get('installer.helper.iohandler'); - $iohandler->add_error_message($msg); - $iohandler->send_response(true); - exit(); - } - catch (\phpbb\install\helper\iohandler\exception\iohandler_not_implemented_exception $e) - { - throw new \phpbb\exception\runtime_exception($msg); + try + { + /** @var \phpbb\install\helper\iohandler\iohandler_interface $iohandler */ + $iohandler = $phpbb_installer_container->get('installer.helper.iohandler'); + $iohandler->add_error_message($msg); + $iohandler->send_response(true); + exit(); + } + catch (\phpbb\install\helper\iohandler\exception\iohandler_not_implemented_exception $e) + { + throw new \phpbb\exception\runtime_exception($msg); + } } + throw new \phpbb\exception\runtime_exception($msg); break; case E_DEPRECATED: return true;