Fixed the issue that ServiceLocator still returns the old component after calling set() with a new definition

This commit is contained in:
Qiang Xue
2014-05-11 15:03:22 -04:00
parent c67c491053
commit 3ea2ffbbd2
2 changed files with 3 additions and 0 deletions

View File

@ -26,6 +26,7 @@ Yii Framework 2 Change Log
- Bug #3327: Fixed "Unable to find debug data" when logging objects with circular references (jarekkozak, samdark)
- Bug #3368: Fix for comparing numeric attributes in JavaScript (technixp)
- Bug: Fixed inconsistent return of `\yii\console\Application::runAction()` (samdark)
- Bug: Fixed the issue that `ServiceLocator` still returns the old component after calling `set()` with a new definition (qiangxue)
- Enh #2264: `CookieCollection::has()` will return false for expired or removed cookies (qiangxue)
- Enh #2435: `yii\db\IntegrityException` is now thrown on database integrity errors instead of general `yii\db\Exception` (samdark)
- Enh #2837: Error page now shows arguments in stack trace method calls (samdark)

View File

@ -188,6 +188,8 @@ class ServiceLocator extends Component
return;
}
unset($this->_components[$id]);
if (is_object($definition) || is_callable($definition, true)) {
// an object, a class name, or a PHP callable
$this->_definitions[$id] = $definition;