Permalink
Browse files

Adding sanity checking to setup() callback for behaviors.

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@8002 3807eeeb-6ff5-0310-8944-8be069107fe0
  • Loading branch information...
1 parent 1111829 commit 76fba20721a2fe36a77ec57fd1fb4be26bb53a91 @nateabele nateabele committed Jan 16, 2009
Showing with 4 additions and 1 deletion.
  1. +4 −1 cake/libs/model/behavior.php
@@ -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) {

0 comments on commit 76fba20

Please sign in to comment.