Skip to content

Consistency issue between the framework-bundle and the http-foundation component #45750

@ecourtial

Description

@ecourtial

Symfony version(s) affected

5.4.6

Description

When migrating from Symfony 4.4 to Symfony 5.4, we get the following error:

Argument 3 passed to Symfony\Component\HttpFoundation\Session\SessionFactory::__construct() must be callable or null, array given

After some research, we found it to be related to the two following parts.

1- In the http-foundation component, we indeed see that the session factory expects a callable as a third argument of the constructor: https://github.com/symfony/http-foundation/blob/34e89bc147633c0f9dd6caaaf56da3b806a21465/Session/SessionFactory.php#L29

2- But in the framework-bundle, we see that it injects an array:
https://github.com/symfony/framework-bundle/blob/a5add2526f6d8c021592443ab2b55416443d6c9e/Resources/config/session.php#L48

This call seems to be triggered by this line of the framework-bundle: https://github.com/symfony/framework-bundle/blob/a5add2526f6d8c021592443ab2b55416443d6c9e/DependencyInjection/FrameworkExtension.php#L434

How to reproduce

A project with the following dependencies:

  • "symfony/http-foundation": "^5.4",
  • "symfony/framework-bundle": "^5.4"

And in your app/config/config_test.yml, add the following entry:

test.session.listener:
    class: xxx\xx\xx\Test\TestSessionListener

Possible Solution

No response

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions