title: Yii :: Use of undefined constant
body: <p>I am using the below code in the accessRules() function to match the roles of the logged in user. The role is set during the authentication process using </p>
  
  <pre><code> $this-&gt;setState('role', $record-&gt;role);
  </code></pre>
  
  <p>The code in the accessRules() function is:</p>
  
  <pre><code>    $role="";
      if(Yii::app()-&gt;user-&gt;getId()===null)
      {
              $role="guest";
      }
      else
      {
          $role=Yii::app()-&gt;user-&gt;role;
      }
  
     return array(
          array('allow', 'actions'=&gt;array('index','view'),
              'users'=&gt;array('*'),
          ),
     );
  </code></pre>
  
  <p>This code is working fine on my local machine but when I upload it to the server it gives me <strong><code>Use of undefined constant guest - assumed 'guest'</code></strong> error.
  What is the reason for this and how can I resolve this. Thanks!!!</p>