Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error using PdoSessionHandler with symfony 6 - "VirtualSessionStorage::start() must be compatible.." #963

Closed
VictorFuentesCereceda opened this issue May 3, 2022 · 1 comment

Comments

@VictorFuentesCereceda
Copy link

I used the ratchet with Symfony5.4 and had no problems with session utilization, but when I switched to Sym 6 I got the following error:


Fatal error: Declaration of Ratchet\Session\Storage\VirtualSessionStorage::start() must be compatible with Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage::start(): bool in /var/www/html/vendor/cboden/ratchet/src/Ratchet/Session/Storage/VirtualSessionStorage.php on line 28
19:01:56 CRITICAL  [php] Fatal Compile Error: Declaration of Ratchet\Session\Storage\VirtualSessionStorage::start() must be compatible with Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage::start(): bool ["exception" => Symfony\Component\ErrorHandler\Error\FatalError^ { …}]


In VirtualSessionStorage.php line 30:
                                                                                                                                                                            
 Compile Error: Declaration of Ratchet\Session\Storage\VirtualSessionStorage::start() must be compatible with Symfony\Component\HttpFoundation\Session\Storage\NativeSess  
  ionStorage::start(): bool                                                       

Config:

# framework.yaml
framework:
    session:
        handler_id: Symfony\Component\HttpFoundation\Session\Storage\Handler\PdoSessionHandler
# services.yaml
    Symfony\Component\HttpFoundation\Session\Storage\Handler\PdoSessionHandler:
        arguments:
            - "mysql:host=%env(resolve:DATABASE_HOST_SAASCORE)%;dbname=%env(resolve:DATABASE_DBNAME_SAASCORE)%"
            -  "%data.session.options%"
# gos_web_socket.yaml
gos_web_socket:
    authentication:
        enable_authenticator: true
        providers:
            session:
                firewalls: ['main']
                session_handler: Symfony\Component\HttpFoundation\Session\Storage\Handler\PdoSessionHandler
@VictorFuentesCereceda
Copy link
Author

VictorFuentesCereceda commented May 9, 2022

We have fixed by lowering the version of http-foundation. We continue with Symfony 6 but http-foundation in 5.4.

# composer.json
...
"symfony/http-foundation": "5.4.*",
"symfony/framework-bundle": "6.0.*"
...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant