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 用verilog实现tanh函数和softplus函数
  • ¥15 求京东批量付款能替代天诚
  • ¥15 slaris 系统断电后,重新开机后一直自动重启
  • ¥15 谁能帮我看看这拒稿理由啥意思啊阿啊
  • ¥15 关于vue2中methods使用call修改this指向的问题
  • ¥15 idea自动补全键位冲突
  • ¥15 请教一下写代码,代码好难
  • ¥15 iis10中如何阻止别人网站重定向到我的网站
  • ¥15 滑块验证码移动速度不一致问题
  • ¥15 Utunbu中vscode下cern root工作台中写的程序root的头文件无法包含