Undefined method stdClass :: user () error while using CakePHP Auth

I am new to CakePHPand and am building a site using the Auth component. A couple of times I tried to do something with this component that caused the error

Fatal error: Call to undefined method stdClass::user() in /ftphome/site/app/controllers/users_controller.php on line 395

This line is the link

$this->User->read(null, $this->Auth->user('id'));

This error does not disappear when I return the code back to how it was before the error, and I can only get rid of it by deleting some files on the server (I'm not sure which files when I tried to delete all the files in the directory tmpwhere an error was saved, so I deleted the entire site and restored it from the latest version of svn revesion.

In this particular case, I think I caused an error by putting the following code in app_controller

class AppController extends Controller {
    function beforeRender() {
        $this->set('test', $this->Auth->user());
    }
}

http://groups.google.com/group/cake-php/browse_thread/thread/ee9456de93d2eece/cff6fe580d13622b?lnk=gst&q=auth

, Auth .

, - Auth, , , - .

Edit

, , , app_controller.php, app/controllers. - - ?

, , , app_controller.php /app/controllers/app_controller.php, /app/app_controller.php - , , , .

+2
1

, ( Auth) , / , ( Auth) , PHP "stdClass" ( .)

(IIRC - Cache CakePHP), .

, CakePHP ( Zend), , Cake , , __autoload .

- , $this- > Auth- > user() , $session- > read ('Auth.User') . , , $this- > Auth - , ?

+2

Source: https://habr.com/ru/post/1720118/


All Articles