Issue #2540538 by znerol: Behavior of testErrorContainer() and testExceptionContainer() is unpredictable

8.0.x
Alex Pott 2015-07-28 17:15:26 +01:00
parent f8629621bb
commit e536cb07af
2 changed files with 15 additions and 5 deletions

View File

@ -18,10 +18,15 @@ class ErrorContainer extends Container {
* {@inheritdoc} * {@inheritdoc}
*/ */
public function get($id, $invalidBehavior = self::EXCEPTION_ON_INVALID_REFERENCE) { public function get($id, $invalidBehavior = self::EXCEPTION_ON_INVALID_REFERENCE) {
// Enforce a recoverable error. if ($id === 'http_kernel') {
$callable = function(ErrorContainer $container) { // Enforce a recoverable error.
}; $callable = function(ErrorContainer $container) {
$callable(1); };
$callable(1);
}
else {
return parent::get($id, $invalidBehavior);
}
} }
} }

View File

@ -18,7 +18,12 @@ class ExceptionContainer extends Container {
* {@inheritdoc} * {@inheritdoc}
*/ */
public function get($id, $invalidBehavior = self::EXCEPTION_ON_INVALID_REFERENCE) { public function get($id, $invalidBehavior = self::EXCEPTION_ON_INVALID_REFERENCE) {
throw new \Exception('Thrown exception during Container::get'); if ($id === 'http_kernel') {
throw new \Exception('Thrown exception during Container::get');
}
else {
return parent::get($id, $invalidBehavior);
}
} }
} }