CAuthItem addChild doesn't return boolean

According to a documentation of addChild function, the return value must be boolean which denotes whether the item is added successfully.

However, the addItemChild function of CDbAuthManager (/yii/framework/web/auth/CDbAuthManager.php:123) returns nothing, thus eventually at successful insert the return value is null.

I highly believe it’s a bug. Temporarily I patched it like the following at line 155:

return $this->db->createCommand()

				->insert($this->itemChildTable, array(



				)) > 0;

Let me know if this is correct.

What Yii version are you using? CDbAuthManager and CPhpAuthManager are both returning true in addItemChild() in 1.1.7, 1.1.8 and 1.1.9, I am also not able to find the lines in the files you mentioned in that yii versions…

However you are right, there is an inconsistency between interface IAuthManager which returns void and the implementation in CDbAuthManager and CPhpAuthManager which return boolean.

Using Yii 1.1.8. Just upgraded to 1.1.9 and I see that “return true” has been added. Regarding that inconsistency, I hope it’ll be fixed in the next release.