I am new to the forum and new to Yii as well. I am having some issues when using the CWebUser::checkAccess() method with the $bizRule parameter and hopefully someone could lend a helping hand.
Basically the issue is around if the business rule is invalid (such as having a typo or parse error), I don’t get any error logs generated nor any notices from Yii. I looked into the source code and I can see the reason is all warnings are suppressed (’@’ is used) when CAuthManager evaluates the business rules in CAuthManager::executeBizRule().
I can see why it does this but I almost pulled my hair off yesterday trying to debug what was going on with my bizrule and at the end I found it was a typo.
//define business rule and assign the rule to a Role and a User Id
Thanks very much, that’s certainly very helpful. I think I might take the extend and override route which gives me full flexibility to handle errors extensively.
One thing I found very helpful debugging in PHP is to follow the PHP error log in Unix Terminal. E.g. type “tail -f /etc/httpd/logs/error_log” (this can vary based on php.ini settings). This can monitor all PHP errors in real time. Undefined variables will also be reported here as long as php.ini is configured to “error_reporting = E_ALL & ~E_NOTICE” instead of “error_reporting = E_ALL” on development platform. However, this wouldn’t help if the error silence operator is used.
The best practice I can recommend is to configure PHP (php.ini) to explode on any type of error - the smallest it can be. This should be configured on development machines and of course turned off on staging/qa/prod. That allows detecting the smallest issues during development - where its the cheapest to fix.