diff options
author | Tristan Darricau <tristan.darricau@sensiolabs.com> | 2015-12-15 20:13:59 +0100 |
---|---|---|
committer | Tristan Darricau <tristan.darricau@sensiolabs.com> | 2016-01-09 15:35:17 +0100 |
commit | 761fa9da52e92efafa6839938113ddb55cd85f17 (patch) | |
tree | 17eec1bb1607c8a0f33a72060810dd87118e9e42 /phpBB/phpbb/di | |
parent | 78349ed80f24cb61ad05f997e97d805cc5b0409f (diff) | |
download | forums-761fa9da52e92efafa6839938113ddb55cd85f17.tar forums-761fa9da52e92efafa6839938113ddb55cd85f17.tar.gz forums-761fa9da52e92efafa6839938113ddb55cd85f17.tar.bz2 forums-761fa9da52e92efafa6839938113ddb55cd85f17.tar.xz forums-761fa9da52e92efafa6839938113ddb55cd85f17.zip |
[ticket/14306] Doesn't try to build a "safe" container in the dev env
PHPBB3-14306
Diffstat (limited to 'phpBB/phpbb/di')
-rw-r--r-- | phpBB/phpbb/di/container_builder.php | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/phpBB/phpbb/di/container_builder.php b/phpBB/phpbb/di/container_builder.php index 95d6483e34..6e6fb5c7fb 100644 --- a/phpBB/phpbb/di/container_builder.php +++ b/phpBB/phpbb/di/container_builder.php @@ -113,7 +113,7 @@ class container_builder * @param string $phpbb_root_path Path to the phpbb includes directory. * @param string $php_ext php file extension */ - function __construct($phpbb_root_path, $php_ext) + public function __construct($phpbb_root_path, $php_ext) { $this->phpbb_root_path = $phpbb_root_path; $this->php_ext = $php_ext; @@ -191,14 +191,26 @@ class container_builder } catch (\Exception $e) { - return $this - ->without_extensions() - ->without_cache() - ->with_custom_parameters(array_merge($this->custom_parameters, [ - 'container_exception' => $e, - ])) - ->get_container() - ; + // Don't try to recover if we are in the development environment + if ($this->get_environment() === 'development') { + throw $e; + } + + try + { + return $this + ->without_extensions() + ->without_cache() + ->with_custom_parameters(array_merge($this->custom_parameters, [ + 'container_exception' => $e, + ])) + ->get_container(); + } + catch (\Exception $_) + { + // Rethrow the original exception if it's still failing + throw $e; + } } } |