dqfxao2898 2018-06-19 12:36
浏览 68
已采纳

如何找出Symfony设置PHPSESSID cookie的原因/位置?

I am running a Symfony 2.8 based webpage which is separated into a public and a private part (login required).

Due to the "new" GDPR regulation in Europe I have checked which cookies my page actually use. Since I do not use any analytics or tracking tools are related stuff, the public part of the web page does actually need any cookies. However, when inspecting the page with Firefox Webmaster Tools I see that the PHPSESSID Cookie is set when visiting the public pages.

My code of the public pages does not actively uses the session (at least not that I am aware of). Sure the session needs to be queried to check if the user is logged in, is this enough to create a session if it does not exists? I suspect that some third party code/bundle might query the session and thus set the cookie.

Is there a way to find out where and why the cookie is set by symfony?

  • 写回答

1条回答 默认 最新

  • douqiao3453 2018-06-19 16:44
    关注

    Usually, php starts session when session_start() happens but it depends on php.ini settings. Symfony starts session dynamically when you first time try to do something with it. I had the same problem few days ago. In my case symfony starts session when tries to get user token from session. What I recommend to do: check what session handler you are using, then make a breakpoint inside it and debug. By default (and in my case) session starts at NativeSessionStorage start method.

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

报告相同问题?

悬赏问题

  • ¥15 宇视监控服务器无法登录
  • ¥15 PADS Logic 原理图
  • ¥15 PADS Logic 图标
  • ¥15 电脑和power bi环境都是英文如何将日期层次结构转换成英文
  • ¥15 DruidDataSource一直closing
  • ¥20 气象站点数据求取中~
  • ¥15 如何获取APP内弹出的网址链接
  • ¥15 wifi 图标不见了 不知道怎么办 上不了网 变成小地球了
  • ¥50 STM32单片机传感器读取错误
  • ¥50 power BI 从Mysql服务器导入数据,但连接进去后显示表无数据