Skip to content
Permalink
Browse files

Fix looping issue in Component loading.

Add failure condition to test suite.

Apple -> Orange -> Banana -> Apple is now the chain
in the testsuite.

Fixes #2168
  • Loading branch information...
markstory committed Oct 28, 2011
1 parent adb5be6 commit 7b023bca12118f387e2b38454b2b148691c5a0f7
Showing with 11 additions and 3 deletions.
  1. +3 −3 cake/libs/controller/component.php
  2. +8 −0 cake/tests/cases/libs/controller/component.test.php
@@ -257,10 +257,10 @@ function _loadComponents(&$object, $parent = null) {
if (!empty($config)) {
$this->__settings[$component] = $config;
}
}
if (isset($object->{$component}->components) && is_array($object->{$component}->components) && (!isset($object->{$component}->{$parent}))) {
$this->_loadComponents($object->{$component}, $component);
if (isset($object->{$component}->components) && is_array($object->{$component}->components) && (!isset($object->{$component}->{$parent}))) {
$this->_loadComponents($object->{$component}, $component);
}
}
}
}
@@ -227,6 +227,14 @@ class BananaComponent extends Object {
*/
var $testField = 'BananaField';
/**
* components property
*
* @var array
* @access public
*/
var $components = array('Apple');
/**
* startup method
*

0 comments on commit 7b023bc

Please sign in to comment.
You can’t perform that action at this time.