yiisoft/yii2 — pull request #1703 by crtlib (2013-12-30 14:14:16+00:00)
Title: Removed redundant code in detachBehaviors()

After ensureBehaviors() call $this->_behaviors is an array already.
And since detachBehavior() unsets elements in $this->_behaviors, $this->_behaviors turns out to be an empty array after all iterations.