douzhang6496 2017-01-04 12:42
浏览 45

用户在zf3中进行身份验证时,zf1 app中的getIdentity

I am migrating our applications from zf1 to zf3. I am authenticating the user in ZF3 and when I goto the ZF1 apps I am getting the following error.

Fatal error: Uncaught exception 'Zend_Session_Exception' with message 'session has already been started by session.auto-start or session_start()' in /usr/local/zendsvr6/var/libraries/Zend_Framework_1/1.12.18/library/Zend/Session.php:464 Stack trace:

#0 /usr/local/zendsvr6/var/libraries/Zend_Framework_1/1.12.18/library/Zend/Session/Namespace.php(143): Zend_Session::start(true)

#1 /usr/local/zendsvr6/var/libraries/Zend_Framework_1/1.12.18/library/Zend/Auth/Storage/Session.php(86): Zend_Session_Namespace->__construct('Zend_Auth')

#2 /usr/local/zendsvr6/var/libraries/Zend_Framework_1/1.12.18/library/Zend/Auth.php(91): Zend_Auth_Storage_Session->__construct()

#3 /usr/local/zendsvr6/var/libraries/Zend_Framework_1/1.12.18/library/Zend/Auth.php(151): Zend_Auth->getStorage()

#4 /www/zendsvr6/htdocs/accessavx/library/Custom/Controller/Plugin/Auth.php(38): Zend_Auth->getIdentity()

#5 /usr/local/zendsvr6/var/libraries/Zend_Framework_1/1.12.18/library/Zend/Controller/Plugin/Broker.php(309): Custom_Controller_Plugin_Auth->preDispatch(O in /usr/local/zendsvr6/var/libraries/Zend_Framework_1/1.12.18/library/Zend/Controller/Plugin/Broker.php on line 312

If I authenticate the user in ZF1 and goto the ZF3 apps this works fine. Is it possible to authenticate the user in ZF3 and use the same session to get the identity in zend framework 1?

  • 写回答

1条回答 默认 最新

  • douyi6168 2017-06-09 21:04
    关注

    There is no right or wrong way to do this.

    You can try to recover by the default container name "Zend_Auth"

    I recommend you dump into your $ _SESSION using print_r or var_dump

    To enable direct access to the value you need within $ _SESSION if you can not otherwise

    See an example of it in $ _SESSION:

    Array
    (
        [Zend_Auth] => Zend\Stdlib\ArrayObject Object
            (
                [storage:protected] => Array
                    (
                        [storage] => stdClass Object
                            (
                                [id] => 1
                            )
    
                    )
    
                [flag:protected] => 2
                [iteratorClass:protected] => ArrayIterator
                [protectedProperties:protected] => Array
                    (
                        [0] => storage
                        [1] => flag
                        [2] => iteratorClass
                        [3] => protectedProperties
                    )
            )
    )
    
    评论

报告相同问题?

悬赏问题

  • ¥20 西门子S7-Graph,S7-300,梯形图
  • ¥50 用易语言http 访问不了网页
  • ¥50 safari浏览器fetch提交数据后数据丢失问题
  • ¥15 matlab不知道怎么改,求解答!!
  • ¥15 永磁直线电机的电流环pi调不出来
  • ¥15 用stata实现聚类的代码
  • ¥15 请问paddlehub能支持移动端开发吗?在Android studio上该如何部署?
  • ¥20 docker里部署springboot项目,访问不到扬声器
  • ¥15 netty整合springboot之后自动重连失效
  • ¥15 悬赏!微信开发者工具报错,求帮改