We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

I was update to php5.6 and phalcon 2.08 so as I cant read cookies value.

When I logined and then logout , in my function I cannot read my cookies like this:

public function cookiesLogin(){
    $salt = 'GYHZMFSWP';
    $permanent  = $this->cookies->get('permanent')->getValue();
    $identifier = $this->cookies->get('identifier')->getValue();
    var_dump($permanent);
    var_dump($identifier);echo "identifier:".$identifier;

    //查找数据库
    $remember=RememberTokens::findFirstByIdentifier($identifier);

    //比对是否是cookie对应的
    if($permanent == $remember->permanent){
            echo "permanent true";
            echo $identifier;
            echo md5($salt . md5($remember->getUser()->name .$salt));
        if($identifier == md5($salt . md5($remember->getUser()->name .$salt))){

            echo "identifier true";
            if((time()-(86400*8))<$remember->createdAt){echo "time true";
                $user= Users::findFirstById($remember->userid );echo "user true";
                $this->regSessionAuth( $user );echo "regSessionAuth true";
                //重新产生cookie
                $this->rememberMe( $user );echo "rememberMe true";
                return true;
            }
        }
    }

    $this->cookies->get('permanent')->delete();
    $this->cookies->get('identifier')->delete();
    return false;
}


58.4k

hi, you need chmod directory session your web server



27.0k
Accepted
answer

thank you your are not the true answer, but I solve it by display errer in php and php-fpm, when dont display error nginx will show 500 error, then error tell me my cookie crypt must be in 16 24 and 32 long charater