Trouble Working With Yii::aapp()->User

I have a strange problem when using Yii::app()->user, If I call it from one method I can’t run almost anything until the running of the script has ended. For example let’s say I have the following method:

public function actionFoo(){

[indent]Yii::app()->user; //just for the example, I know it doesn't mean anything[/indent]

[indent]sleep(30); //just so it won't finish right away[/indent]

[indent]echo "end of function Foo";  [/indent]


Now if I call the URL related to actionFoo and after I’ll try to call a different URL from another tab before the first one has finished the following happened:

  1. If I enter an invalid URL that belongs to the same project I won’t get a response until the end of actionFoo, meaning I won’t get 404 Bad Request.

2.If I enter a valid URL that’s related to a method that also use Yii::app()->user - The same as in #1.

  1. If I enter a valid URL that’s related to a method that doesn’t use Yii::app()->user - everything seems to work.

Hope everything is clear and if not feel free to ask.

Hi abcd,

Have you already solved the problem that you had described in the preceding post … ?

It looks to me that you may have some problem with your setting up of your development and/or production environment … I mean the configurations of the web server and PHP. It’s only a guess, but I think you would be better to establish a reliable environment at first before you start to dig deep into your development.