dongnao1908
2013-05-27 15:02
浏览 49
已采纳

ZF2:身份验证会话出现问题

I have a strange problem with the session after an authentication.

The whole authentification part works, troubles come after that :

        $result = $this->getAuthService()->authenticate();

            if ($result->isValid()) {
                $storage = $this->getAuthService()->getStorage();
                $storage->write(($this->getAuthService()
                        ->getAdapter()
                        ->getResultRowObject(array(
                                'email_utilisateur',
                                'password_utilisateur',
                            ))));
                $redirect = 'success';                    
            }

Right now, I am logged, and email+password are stored, in the "Zend_Auth" key (don't pay attention to the fact that I store password btw, it's for the example ^^).

But when I go on another page (even if it's the same), my Session key "Zend_auth" gets broken, and I have an incomplete PHP object....

Array
(
     [__ZF] => Array
         (
             [_REQUEST_ACCESS_TIME] => 1369667659.7526
         )

     [Zend_Auth] => __PHP_Incomplete_Class Object
        (
            [__PHP_Incomplete_Class_Name] => Zend\Stdlib\ArrayObject
        )

)

So, any idea why changing page would screw my session variable ?

Thanks in advance, I've spent like 5 hours on this problem, testing things etc...

EDIT 28/05/2013 :

So, I still didn't find. Anyway, the object that gets corrupted is a Zend\Stdlib\ArrayObject. A reason why this arrayobject gets corrupted would be that the session starts before the inclusion avec Zend\Stdlib\ArrayObject. I'll try to figure it out, but if that's the reason, then it's a bug of the framework. By the way, I'm using ZF 2.2.

图片转代码服务由CSDN问答提供 功能建议

验证后会话出现奇怪问题。

整个认证部分工作,麻烦来了:

  $ result = $ this-> getAuthService() - > authenticate(); 
 
 if($ result  - > isValid()){
 $ storage = $ this-> getAuthService() - > getStorage(); 
 $ storage-> write(($ this-> getAuthService()
  - >  ; getAdapter()
  - > getResultRowObject(array(
'email_utilisateur',
'password_utilisateur',
)))); 
 $ redirect ='success';  
} 
   
 
 

现在,我已经登录,并且在“Zend_Auth”键中存储了电子邮件+密码(不要注意这个事实 我存储密码btw,它是示例^^)。

但是当我进入另一个页面时(即使它是相同的),我的会话密钥“Zend_auth”被破坏了,我 有一个不完整的PHP对象....

  Array 
(
 [__ZF] => Array 
(
 [_REQUEST_ACCESS_TIME] => 1369667659.7526 
  )
 
 [Zend_Auth] => __PHP_Incomplete_Class Object 
(
 [__PHP_Incomplete_Class_Name] => Zend \ Stdlib \ ArrayObject 
)
 
)
   
 \  n 

那么,任何想法为什么更改页面会搞砸我的会话变量?

提前谢谢,我花了5个小时来解决这个问题,测试等等... < / p>

编辑28/05/2013:

所以,我仍然没有找到。 Anyway,对象 被损坏的是Zend \ Stdlib \ ArrayObject。 这个arrayobject被破坏的原因是会话在包含avec Zend \ Stdlib \ ArrayObject之前开始。 我会试着弄清楚,但如果这就是原因,那么它就是框架的一个错误。 顺便说一句,我使用的是ZF 2.2。

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

1条回答 默认 最新

相关推荐 更多相似问题