[ticket/14306] CS and correctly handle exception loop

PHPBB3-14306
This commit is contained in:
Tristan Darricau 2016-01-09 15:32:11 +01:00
parent 7f8b6c02c6
commit 6594ef8b1e
2 changed files with 14 additions and 8 deletions

View file

@ -146,10 +146,10 @@ function popup(url, width, height, name)
<div id="main"> <div id="main">
<div class="main"> <div class="main">
<!-- IF CONTAINER_EXCEPTION !== false --> {% if CONTAINER_EXCEPTION !== false %}
<div class="errorbox"> <div class="errorbox">
<p>{L_CONTAINER_EXCEPTION}</p> <p>{{ lang('CONTAINER_EXCEPTION') }}</p>
<p>{L_EXCEPTION}{L_COLON} {{ CONTAINER_EXCEPTION.getMessage() }}</p> <p>{{ lang('EXCEPTION') }}{{ lang('COLON') }} {{ CONTAINER_EXCEPTION.getMessage() }}</p>
<pre>{{ CONTAINER_EXCEPTION.getTraceAsString() }}</pre> <pre>{{ CONTAINER_EXCEPTION.getTraceAsString() }}</pre>
</div> </div>
<!-- ENDIF --> {% endif %}

View file

@ -107,6 +107,9 @@ class container_builder
*/ */
private $container_extensions; private $container_extensions;
/** @var \Exception */
private $build_exception;
/** /**
* Constructor * Constructor
* *
@ -126,7 +129,8 @@ class container_builder
*/ */
public function get_container() public function get_container()
{ {
try { try
{
$container_filename = $this->get_container_filename(); $container_filename = $this->get_container_filename();
$config_cache = new ConfigCache($container_filename, defined('DEBUG')); $config_cache = new ConfigCache($container_filename, defined('DEBUG'));
if ($this->use_cache && $config_cache->isFresh()) if ($this->use_cache && $config_cache->isFresh())
@ -197,8 +201,10 @@ class container_builder
throw $e; throw $e;
} }
try if ($this->build_exception === null)
{ {
$this->build_exception = $e;
return $this return $this
->without_extensions() ->without_extensions()
->without_cache() ->without_cache()
@ -207,10 +213,10 @@ class container_builder
])) ]))
->get_container(); ->get_container();
} }
catch (\Exception $_) else
{ {
// Rethrow the original exception if it's still failing // Rethrow the original exception if it's still failing
throw $e; throw $this->build_exception;
} }
} }
} }