trejder
trejder

Reputation: 17495

Yii displays standard error even in debug mode

I have a bug in my CGridView. One of the columns tries to read a property from non object. Just before line, that renders this grid view (i.e. just above <?php $this->widget('GridView', array () I placed following code:

<?php
    echo 'YII_DEBUG = '.print_r(YII_DEBUG, TRUE);
    var_dump(YII_DEBUG);
    echo 'YII_TRACE_LEVEL = '.print_r(YII_TRACE_LEVEL, TRUE);
    var_dump(YII_TRACE_LEVEL);
    die();
?>

And it gives me following results:

YII_DEBUG = 1
bool(true)
YII_TRACE_LEVEL = 3
int(3)

However, when I remove or comment-out this code, the very next line (where error occurs) does not causes Yii to render typical, full-stack debug information (including file, line and stack trace) about error. Instead, I see a one-line error message, rendered with site/error view, just as I should see it, when debug would actually be turned off (but, it isn't):

enter image description here

I've been struggling with this for months, but I have no cluse, what can cause Yii to ignore debug settings and display errors without debug stack trace even, when debug mode is enabled.

Can anyone help here, by at least giving some tip, where should I start to look for?

Upvotes: 2

Views: 1029

Answers (1)

trejder
trejder

Reputation: 17495

This is by design, because of recent change in Yii 1.1.16. One need to put:

'errorHandler'=>array(
    'errorAction' => YII_DEBUG ? null : 'site/error',
),

to application's configuration array, to have in 1.1.16 the same behavior as in earlier versions of Yii -- i.e. to have full-stack errors always rendered, when YII_DEBUG is set to true.

Upvotes: 2

Related Questions