Yii catching all php errors and redirection linked to display_errors ?

We’ve come across a very odd situation where the Yii application log is now logging all php generated errors, so nothing is being written to the php error log.

I’m getting the following error generated by CHtml

The problem I have is not the error itself, it’s that with php display_errors off, this causes the application to render the actionError.

With php display_errors on, this does not fail out to the error page, but renders the form as if there is NO error whatsoever.

This behavior is completely inexplicable to me … I’m wondering if anyone has any insight on why this would be and whether it’s “normal” that the yii log should be catching the php level errors?

The following provides some solid information, but doesn’t explain why one situation would consider it an error and the other would not?? Error logging level is not changed, only the display_errors value

http://www.yiiframework.com/doc/guide/1.1/en/topics.error

Most likely the data is corrupt or the encoding is not correct.

Supposedly, this function results in an E_WARNING when display_errors is off and an invalid multibyte string is passed to it (e.g. with ‘utf-8’ as the encoding parameter and broken utf-8 characters somewhere in the string).

https://bugs.php.net/bug.php?id=47494

Thanks, i will look into that further!

Hi,

this may not be the prettiest solution, but it works for display_errors on and off.

in config/main.php:




'onError'=>create_function('$event', '$url=Yii::app()->createUrl("/site/unhandled"); Yii::app()->getController()->redirect($url);'),



in SiteController:




public function actionUnhandled(){

	throw new CHttpException(500, 'Unknown error occured! Check logs..');

}



Cheers

Lubos