diff --git a/cake/console/libs/task_collection.php b/cake/console/libs/task_collection.php index 32f0b31a4..df29d3d26 100644 --- a/cake/console/libs/task_collection.php +++ b/cake/console/libs/task_collection.php @@ -48,11 +48,10 @@ class TaskCollection extends ObjectCollection { * * @param string $task Task name to load * @param array $settings Settings for the task. - * @param boolean $enable Whether or not this task should be enabled by default * @return Task A task object, Either the existing loaded task or a new one. * @throws MissingTaskFileException, MissingTaskClassException when the task could not be found */ - public function load($task, $settings = array(), $enable = true) { + public function load($task, $settings = array()) { list($plugin, $name) = pluginSplit($task, true); if (isset($this->_loaded[$name])) { @@ -72,6 +71,7 @@ class TaskCollection extends ObjectCollection { $this->_loaded[$name] = new $taskClass( $this->_Shell->stdout, $this->_Shell->stderr, $this->_Shell->stdin ); + $enable = isset($settings['enabled']) ? $settings['enabled'] : true; if ($enable === true) { $this->_enabled[] = $name; } diff --git a/cake/libs/controller/component_collection.php b/cake/libs/controller/component_collection.php index 5efb7c888..2a483cc21 100644 --- a/cake/libs/controller/component_collection.php +++ b/cake/libs/controller/component_collection.php @@ -74,7 +74,7 @@ class ComponentCollection extends ObjectCollection { * @throws MissingComponentFileException, MissingComponentClassException when the component could not be found */ public function load($component, $settings = array()) { - if (isset($settings['className'])) { + if (is_array($settings) && isset($settings['className'])) { $alias = $component; $component = $settings['className']; } diff --git a/cake/libs/model/behavior_collection.php b/cake/libs/model/behavior_collection.php index 2035a77a0..30c9c1469 100644 --- a/cake/libs/model/behavior_collection.php +++ b/cake/libs/model/behavior_collection.php @@ -99,7 +99,7 @@ class BehaviorCollection extends ObjectCollection { * @throws MissingBehaviorFileException or MissingBehaviorClassException when a behavior could not be found. */ public function load($behavior, $config = array()) { - if (isset($config['className'])) { + if (is_array($config) && isset($config['className'])) { $alias = $behavior; $behavior = $config['className']; } diff --git a/cake/libs/model/db_acl.php b/cake/libs/model/db_acl.php index e8a31cef7..4782cfc91 100644 --- a/cake/libs/model/db_acl.php +++ b/cake/libs/model/db_acl.php @@ -46,7 +46,7 @@ class AclNode extends AppModel { * @var array * @access public */ - public $actsAs = array('Tree' => 'nested'); + public $actsAs = array('Tree' => array('nested')); /** * Constructor diff --git a/cake/libs/view/helper_collection.php b/cake/libs/view/helper_collection.php index 35e6e0dd4..d90289e21 100644 --- a/cake/libs/view/helper_collection.php +++ b/cake/libs/view/helper_collection.php @@ -57,7 +57,7 @@ class HelperCollection extends ObjectCollection { * @throws MissingHelperFileException, MissingHelperClassException when the helper could not be found */ public function load($helper, $settings = array()) { - if (isset($settings['className'])) { + if (is_array($settings) && isset($settings['className'])) { $alias = $helper; $helper = $settings['className']; } diff --git a/cake/libs/view/view.php b/cake/libs/view/view.php index ef1d46b9f..7318a829d 100644 --- a/cake/libs/view/view.php +++ b/cake/libs/view/view.php @@ -623,7 +623,7 @@ class View extends Object { public function loadHelpers() { $helpers = HelperCollection::normalizeObjectArray($this->helpers); foreach ($helpers as $name => $properties) { - $this->Helpers->load($properties['class'], $properties['settings'], true); + $this->Helpers->load($properties['class'], $properties['settings']); } $this->_helpersLoaded = true; } diff --git a/cake/tests/cases/console/libs/task_collection.test.php b/cake/tests/cases/console/libs/task_collection.test.php index 27a43e619..74c0c61f2 100644 --- a/cake/tests/cases/console/libs/task_collection.test.php +++ b/cake/tests/cases/console/libs/task_collection.test.php @@ -63,7 +63,7 @@ class TaskCollectionTest extends CakeTestCase { * @return void */ function testLoadWithEnableFalse() { - $result = $this->Tasks->load('DbConfig', array(), false); + $result = $this->Tasks->load('DbConfig', array('enabled' => false)); $this->assertInstanceOf('DbConfigTask', $result); $this->assertInstanceOf('DbConfigTask', $this->Tasks->DbConfig); diff --git a/cake/tests/cases/libs/object_collection.test.php b/cake/tests/cases/libs/object_collection.test.php index b01a93627..e3a0f82ca 100644 --- a/cake/tests/cases/libs/object_collection.test.php +++ b/cake/tests/cases/libs/object_collection.test.php @@ -54,16 +54,16 @@ class GenericObjectCollection extends ObjectCollection { * * @param string $object Object name * @param array $settings Settings array - * @param boolean $enable Start object as enabled * @return array List of loaded objects */ - public function load($object, $settings = array(), $enable = true) { + public function load($object, $settings = array()) { list($plugin, $name) = pluginSplit($object); if (isset($this->_loaded[$name])) { return $this->_loaded[$name]; } $objectClass = $name . 'GenericObject'; $this->_loaded[$name] = new $objectClass($this, $settings); + $enable = isset($settings['enabled']) ? $settings['enabled'] : true; if ($enable === true) { $this->_enabled[] = $name; }