2

I try to add e-commerce features into a legacy project, so I still need my old session-handler. I use PHP v7.1.14 and Session2DB (https://github.com/voku/session2db/tree/4.0.0) in this project. Now I have a strange problem with this "Legacy Project" + Symfony 3.4.4 + Sylius 1.1.0 and the session handling.

Symfony session config:

session:
    storage_id: session.storage.php_bridge
    handler_id: ~

Info: https://symfony.com/doc/3.4/session/php_bridge.html

Error: if I try to login into the admin view of Sylius, I see this error

session_start(): Failed to decode session object. Session has been destroyed

... any idea how I can debug / fix this?

EDIT: If I try to use native php session handling in the legacy project + the above Symfony config I get the following error. So I think the decode error is something in Session2DB.

Failed to unserialize the security token from the session.

... maybe any idea how I can debug / fix this?

Lars Moelleken
  • 719
  • 8
  • 17
  • 1
    What kind of data are you storing in the sessions? Is it unicode characters by chance? – ishegg Feb 19 '18 at 02:37
  • Yes by chance there is also unicode, but the database and the database connection etc. is using utf8mb4. – Lars Moelleken Feb 19 '18 at 08:48
  • How about `serialize()`ing? My guess is that the session handler (`Session2DB`) somehow can't read the data in the session. – ishegg Feb 19 '18 at 12:37
  • yes maybe... I found a old blog post about "legacy-session" + Symfony here -> http://tech.trivago.com/2015/08/26/writing-to-legacy-session/ and they also recommend to check the "session_encode" from php. – Lars Moelleken Feb 19 '18 at 14:02

1 Answers1

1

Im my case, the reason of error was non-encoded output of random_bytes() function stored in session variable.

NXT
  • 1,981
  • 1
  • 24
  • 30