简体   繁体   中英

Session started but not found in Cakephp

I have an application that I work in that is experiencing a problem where randomly a blank page loads.

I've found that the beforeFilter function fires but it never goes into the action of the controller that is being called at that time. I have also found that the session when this happens can not be found. session_status() returns PHP_SESSION_NONE. When the page is reloaded php can magically find the session again and the page loads normally.

Any help is appreciated. If you need/would like more information just let me know.

EDIT:

AppController beforeFilter

public function beforeFilter() {

        parent::beforeFilter();

        // Log all access to applictaion
        $this->AccessLog->logPageAccess($this->request, $this->Session);

        // Read the app's desired datetime display and set as view variable for TimeHelper use.
        if(Configure::check('Datetime.dateDisplayFormat')) {
            $timeFormat = Configure::read('Datetime.dateDisplayFormat');
            $this->set(compact('timeFormat'));
        }
    }

Session Auth.User when session found

array(
    'password' => '*****',
    'id' => '44',
    'role_id' => '5',
    'username' => 'user',
    'password_token' => null,
    'email' => 'user@example.com',
    'email_verified' => true,
    'email_token' => null,
    'email_token_expires' => null,
    'active' => true,
    'is_login_locked' => false,
    'last_login' => '2015-02-04 16:41:47',
    'last_action' => null,
    'created' => '2014-07-07 12:45:46',
    'modified' => '2015-02-04 16:41:47',
    'created_by' => '19',
    'modified_by' => '44',
    'deleted' => false,
    'deleted_date' => null,
    'account_locked' => false,
    'lu_theme_id' => '4',
    'first_name' => 'Joe',
    'last_name' => 'Bloggs',
    'Role' => array(
        'id' => '1',
        'name' => 'User',
        'is_admin' => false
    )
)

$_SESSION when not found

array()

Are you running an array of servers under a load balancer? I've seen session weirdness in that type of environment before now.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM