[ticket/14306] Doesn't try to build a "safe" container in the dev env

PHPBB3-14306
This commit is contained in:
Tristan Darricau 2015-12-15 20:13:59 +01:00
parent 78349ed80f
commit 761fa9da52

View file

@ -113,7 +113,7 @@ class container_builder
* @param string $phpbb_root_path Path to the phpbb includes directory. * @param string $phpbb_root_path Path to the phpbb includes directory.
* @param string $php_ext php file extension * @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->phpbb_root_path = $phpbb_root_path;
$this->php_ext = $php_ext; $this->php_ext = $php_ext;
@ -190,6 +190,13 @@ class container_builder
return $this->container; return $this->container;
} }
catch (\Exception $e) catch (\Exception $e)
{
// Don't try to recover if we are in the development environment
if ($this->get_environment() === 'development') {
throw $e;
}
try
{ {
return $this return $this
->without_extensions() ->without_extensions()
@ -197,8 +204,13 @@ class container_builder
->with_custom_parameters(array_merge($this->custom_parameters, [ ->with_custom_parameters(array_merge($this->custom_parameters, [
'container_exception' => $e, 'container_exception' => $e,
])) ]))
->get_container() ->get_container();
; }
catch (\Exception $_)
{
// Rethrow the original exception if it's still failing
throw $e;
}
} }
} }