Skip to content

Commit

Permalink
Adding sanity checking to setup() callback for behaviors.
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@8002 3807eeeb-6ff5-0310-8944-8be069107fe0
  • Loading branch information
nateabele committed Jan 16, 2009
1 parent 1111829 commit 76fba20
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion cake/libs/model/behavior.php
Expand Up @@ -279,12 +279,15 @@ function attach($behavior, $config = array()) {
$this->{$name} =& new $class;
}
} elseif (isset($this->{$name}->settings) && isset($this->{$name}->settings[$this->modelName])) {
if ($config !== null && $config !== false) {
if (!empty($config)) {
$config = array_merge($this->{$name}->settings[$this->modelName], $config);
} else {
$config = array();
}
}
if (empty($config)) {
$config = array();
}
$this->{$name}->setup(ClassRegistry::getObject($this->modelName), $config);

foreach ($this->{$name}->mapMethods as $method => $alias) {
Expand Down

0 comments on commit 76fba20

Please sign in to comment.