diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index e1f6fa3d1b..c2f173b345 100644
--- a/phpBB/includes/functions.php
+++ b/phpBB/includes/functions.php
@@ -3395,7 +3395,7 @@ function msg_handler($errno, $msg_text, $errfile, $errline)
 				$log_text .= '<br /><br />BACKTRACE<br />' . $backtrace;
 			}
 
-			if (defined('IN_INSTALL') || $phpbb_container->getParameter('debug.show_errors') || isset($auth) && $auth->acl_get('a_'))
+			if (defined('IN_INSTALL') || ($phpbb_container != null && $phpbb_container->getParameter('debug.show_errors')) || isset($auth) && $auth->acl_get('a_'))
 			{
 				$msg_text = $log_text;