doulandai0641 2015-10-18 19:05
浏览 61
已采纳

奇怪的意外用户注销 - symfony 2.3.32

I really did all the best trying to resolve this issue with no avail. All similar questions on SO don't seem easy for me to understand. User get logged out after one page refresh, sometimes after two...there is no logic in this behaviour.

I am not familiar to log files, it is the first time I am reading them and I hope I am giving you the appropriate lines among the hundreds. By the way, these lines are about some internal Symfony stuff that I still don't get:

[2015-10-18 20:48:18] request.INFO: Matched route "user_admin_page" (parameters:"_controller": "Members\Bundle\ManagementBundle\Controller\AdminController::indexAction", "_route": "user_admin_page") [] []

.......

[2015-10-18 20:48:18] event.DEBUG: Notified event "kernel.request" to listener "Symfony\Component\Security\Http\Firewall::onKernelRequest". [] [] [2015-10-18 20:48:19] security.INFO: Populated SecurityContext with an anonymous Token [] []

[2015-10-18 20:48:19] event.DEBUG: Notified event "kernel.exception" to listener "Symfony\Component\Security\Http\Firewall\ExceptionListener::onKernelException". [] []

[2015-10-18 20:48:19] security.DEBUG: Access is denied (user is not fully authenticated) by "C:\xampp\htdocs\community\vendor\symfony\symfony\src\Symfony\Component\Security\Http\Firewall\AccessListener.php" at line 70; redirecting to authentication entry point [] []

[2015-10-18 20:48:19] security.DEBUG: Calling Authentication entry point [] []

[2015-10-18 20:48:19] event.DEBUG: Listener "Symfony\Component\Security\Http\Firewall\ExceptionListener::onKernelException" stopped propagation of the event "kernel.exception". [] []

......

[2015-10-18 20:48:19] event.DEBUG: Notified event "kernel.response" to listener "Symfony\Component\Security\Http\Firewall\ContextListener::onKernelResponse". [] []

[2015-10-18 20:48:19] security.DEBUG: Write SecurityContext in the session [] []

Your help is much appreciated.

  • 写回答

1条回答 默认 最新

  • dtamho6404 2015-10-19 18:50
    关注

    Thank you everybody for giving time to this issue. Apparently, here is the cause and possible solution:

    In my website, I used Ratchet, which is a PHP library that provides real-time connections over websockets. To attach a web session to a websocket connection I used the Ratchet Session Provider:

    The SessionProvider will attach a Symfony2 Session object to each incoming Connection object that will give you read-only access to the session data from your website. The SessionProvider will not work with any of the Native* session handlers. It is suggested you use choose one of the following Symfony Custom Save Handlers:

    MemcacheSessionHandler MemcachedSessionHandler PdoSessionHandler (in development) RedisSessionHandler

    I used the PdoSessionHandler, which brought a change in my configuration from:

    framework:
        ...
        session:
          handler_id: ~
    

    to:

    framework:
        ...
        session:
          handler_id: session.handler.pdo # old configuration that caused the
    

    Switching back to old situation removes the issue. Possible solution then:

    • Use another approach in storing session data.
    • Upgrade from Symfony 2.3 to Symfony 2.6, according to docs, many enhancements were added to PdoSessionHandler wich requires additionnal changes in code.
    • Keep the same code, upgrade Symfony2 but change the handler name to LegacyPdoSessionHanlder.

    Further details:

    http://symfony.com/doc/current/cookbook/doctrine/pdo_session_storage.html http://socketo.me/docs/sessions

    Other solutions that I don't see due to my limited knowlege are welcome.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 安卓adb backup备份应用数据失败
  • ¥15 eclipse运行项目时遇到的问题
  • ¥15 关于#c##的问题:最近需要用CAT工具Trados进行一些开发
  • ¥15 南大pa1 小游戏没有界面,并且报了如下错误,尝试过换显卡驱动,但是好像不行
  • ¥15 没有证书,nginx怎么反向代理到只能接受https的公网网站
  • ¥50 成都蓉城足球俱乐部小程序抢票
  • ¥15 yolov7训练自己的数据集
  • ¥15 esp8266与51单片机连接问题(标签-单片机|关键词-串口)(相关搜索:51单片机|单片机|测试代码)
  • ¥15 电力市场出清matlab yalmip kkt 双层优化问题
  • ¥30 ros小车路径规划实现不了,如何解决?(操作系统-ubuntu)