Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Sloth's avatar

Session persists across multiple users.

I'm working on a shopping cart system and I'm storing the items using Session::put() / Session::push()

If I logout and login into another account the previous account's cart items show up in the current account's cart. Any suggestions? Am I using Session wrong? All input is helpful,

Thanks.

0 likes
1 reply
Sloth's avatar
Sloth
OP
Best Answer
Level 1

I fixed it by adding Session::flush() to the getLogout() method so now from what I can tell so far the cart items don't carry over.

Please or to participate in this conversation.