Fixes #15802: Fixed exception class in yii\di\Container

This commit is contained in:
Elvira Sheina
2018-09-09 03:12:32 +05:00
committed by Alexander Makarov
parent dad0938918
commit 633d6b93b8
3 changed files with 17 additions and 1 deletions

View File

@ -17,6 +17,7 @@ Yii Framework 2 Change Log
- Bug #16006: Handle case when `X-Forwarded-Host` header have multiple hosts separated with a comma (pgaultier)
- Bug #16010: Fixed `yii\filters\ContentNegotiator` behavior when GET parameters contain an array (rugabarbo)
- Bug #14660: Fixed `yii\caching\DbCache` concurrency issue when set values with the same key (rugabarbo)
- Bug #15802: Fixed exception class in yii\di\Container (vuchastyi, developeruz)
- Bug #15988: Fixed bash completion (alekciy)
- Bug #15798: Fixed render `yii\grid\RadioButtonColumn::$content` and `yii\grid\CheckboxColumn::$content` (lesha724)
- Bug #15548: Fixed index names collision in RBAC (gonimar)

View File

@ -256,6 +256,7 @@ class Container extends Component
unset($this->_singletons[$class]);
return $this;
}
/**
* Registers a class definition with this container and marks the class as a singleton class.
*
@ -417,6 +418,7 @@ class Container extends Component
* Returns the dependencies of the specified class.
* @param string $class class name, interface name or alias name
* @return array the dependencies of the specified class.
* @throws InvalidConfigException if a dependency cannot be resolved or if a dependency cannot be fulfilled.
*/
protected function getDependencies($class)
{
@ -425,7 +427,11 @@ class Container extends Component
}
$dependencies = [];
$reflection = new ReflectionClass($class);
try {
$reflection = new ReflectionClass($class);
} catch (\ReflectionException $e) {
throw new InvalidConfigException('Failed to instantiate component or class "' . $class . '".', 0, $e);
}
$constructor = $reflection->getConstructor();
if ($constructor !== null) {