Fixes #13508: Fixed duplicate attachment of behavior BC break

Fixes BC break introduced in
954c771fdb (diff-d45d5e14cbb9739c2e1c63b53ba5e363L669)
This commit is contained in:
Carsten Brandt
2017-02-04 13:47:04 +01:00
committed by Alexander Makarov
parent 5eded299e0
commit 25b78aa615
3 changed files with 52 additions and 9 deletions

View File

@ -1,10 +1,10 @@
Yii Framework 2 Change Log
==========================
2.0.12 under development
2.0.11.2 under development
--------------------------
- no changes in this release.
- Bug #13508: Fixed duplicate attachment of behavior BC break (cebe)
2.0.11.1 February 02, 2017

View File

@ -669,14 +669,14 @@ class Component extends Object
if (is_int($name)) {
$behavior->attach($this);
$this->_behaviors[] = $behavior;
} else {
if (isset($this->_behaviors[$name])) {
$this->_behaviors[$name]->detach();
}
$behavior->attach($this);
$this->_behaviors[$name] = $behavior;
}
if (isset($this->_behaviors[$name])) {
$this->_behaviors[$name]->detach();
}
$behavior->attach($this);
$this->_behaviors[$name] = $behavior;
return $behavior;
}
}