Conflicting behavior

The first time I found this problem is when using Rights extension. Rights has a behavior name getName() which used in RBehavior that going to attach the user class model.

Unfortunately, some user table could be have a field named "name". And because of that it has getName(). And now Rights attach getName() behavior to the user class.

The problem is, it doesn’t throw exception. That’s why making it is so hard to debug…

In order to avoid such conflicts you need to specify behavior name explicitly every time you are calling a method.

But, what I think is, isn’t it better for Yii to throw exception when somebody is attaching an existing behavior? At least it is easier to trace error rather than silently using one of the behaviors…

That’s why I post it in the Bug Discussion. I am only using Rights as my example~

Attaching multiple behaviors with the same named methods is pretty valid since you can specify behavior name explicitly. Additionally it is not efficient to check all attached behaviors when calling a method without specifying behavior name.

I see…

Thanks for the explanation :)