session_cache_limiter error in symfony2.8 with php 7.2
Asked Answered
A

2

7

I am working on the project which is already build on Symfony. The versions and server details are as below

PHP: 7.2

Webserver: apache 2.4.6

Symfony: 2.8.1.1

I am getting below warning while initializing new session on my controller. This issue comes only when I am working on debugger mode(app_dev.php) not on production environment.

"Warning: session_cache_limiter(): Cannot change cache limiter when session is active"

I have gone through the issue over google and seen that it is core PHP warning.

How can we solve this with symfony 2.8 version?

Anthrax answered 31/10, 2018 at 9:11 Comment(1)
See this link .#24965199Cytology
S
4

It seems somewhere in the framework session_cache_limiter() is called after session_start(). It should be called before.

Solus answered 31/10, 2018 at 9:24 Comment(4)
@NikhilJoshi hey, did you find finnaly solution to this bug?Kid
@TomekKobyliński Not Yet.Anthrax
@vrajeshDoshi, Thanks for insights, I have had tried this option. and we checked we were not setting the same anywhere. Though We have solved the issue.Anthrax
@vrajesh I have added detailed Analysis This will help other to resolve itAnthrax
A
2

Who face this issue. Please do the below checks in the system. 1. Check if anywhere in Yaml files have we set cache_limiter. The default have to be zero.

parameters:
    session.storage.options:
        cache_limiter: 0
  1. In the flow also have a check if Session is getting set somewhere other than Autoload.

https://symfony.com/doc/2.8/components/http_foundation/sessions.html

  1. The most important is DO NOT USE session_start use Symfony's session->start.

In our application being legacy one It was found that at many places session_start was used. Thus as correctly said by @vrajesh session_start was being used.

Anthrax answered 18/11, 2019 at 8:42 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.