Yii()::app->user problem

I have this code at my mainmenu view of BackMenu CWidget.


<?php $a=Yii::app()->user->name; echo CHtml::link("$a",$profileurl['user']) ;?>

At xampp-windows vista it works ok but at debian/apache there is the error Undefined index: user

Also I see thet the link is there were I am not at debug mode.

This view use also and the main menu CWidget(with other menu) but it is ok.

What is wrong?

check your error_reporting on your windows

What does


<?php var_dump($profileurl);

?

That’s the same like in your ather topic: It’s due to php’s error reporting set to E_STRICT. That means, you should check if a key exists in an array before reading it. It’s good practice to always do so.


if (isset($profileurl['user'])) ...