symfony: Symfony 6.3@dev Unexpected ini_set(): Session ini settings cannot be changed after headers have already been sent
Symfony version(s) affected
6.3.0@dev (6.2.*@dev works)
Description
Something seems to be merged into Symfony 6.3 branch which currently let our CI fail on it with:
Warning PHP Warning: ini_set(): Session ini settings cannot be changed after headers have already been sent in /home/runner/work/sulu/sulu/vendor/symfony/http-foundation/Session/Storage/Handler/NativeFileSessionHandler.php on line 48
PHP Warning: ini_set(): Session ini settings cannot be changed after headers have already been sent in /home/runner/work/sulu/sulu/vendor/symfony/http-foundation/Session/Storage/Handler/NativeFileSessionHandler.php on line 49
So it looks some changes in the Session handling. Not sure what it could be, shortly looked at the merged Pull Requests I didn’t see why it is happening.
I tested out 6.2.*@dev there all seems to work still like expected.
If somebody have a hint which PR could have introduced the error let me know, happy to test it out.
How to reproduce
git clone git@github.com:sulu/sulu.git
cd sulu
composer config minimum-stability dev
composer update
env DATABASE_URL="mysql://root:ChangeMe@127.0.0.1:3306/sulu?serverVersion=8.0.27&charset=utf8mb4" composer bootstrap-test-env
env DATABASE_URL="mysql://root:ChangeMe@127.0.0.1:3306/sulu?serverVersion=8.0.27&charset=utf8mb4" composer test
Possible Solution
Workaround see: https://github.com/symfony/symfony/issues/49387#issuecomment-1600546860
Additional Context
The change need to be somewhere between Januaray 25 and February 6 and only Symfony 6.3:

About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 23 (22 by maintainers)
Commits related to this issue
- feature #49610 [DoctrineBridge] deprecate doctrine schema subscribers in favor of listeners (alli83) This PR was merged into the 6.3 branch. Discussion ---------- [DoctrineBridge] deprecate doctrin... — committed to symfony/symfony by nicolas-grekas a year ago
- feature #49918 [DoctrineBridge] Deprecate passing doctrine subscribers to ContainerAwareEventManager (alli83) This PR was merged into the 6.3 branch. Discussion ---------- [DoctrineBridge] Deprecat... — committed to symfony/symfony by fabpot a year ago
yes if no one is ont it already, I would be glad to have a look on it
Why I think it would be good if the PDOSessionListener is only registered when PDO session is used. I currently found a workaround to fix the issue which did only appear with the
SuluTestKernel(used by bundles not projects). I had to manually setting thehandler_id: nulle.g.:This way the error seems to disappear.
I propose renaming all
*Subscriberto*Listener, and to deprecateMessengerTransportDoctrineSchemaSubscriber,DoctrineDbalCacheAdapterSchemaSubscriberandRememberMeTokenProviderDoctrineSchemaSubscriber(making them extend their corresponding*Listener)Doctrine\Common\EventSubscribershould be banned from the bridge because it forces instantiating the event listeners (and their deps) even if they are never called.