Should I include underscore in session cookie name?
Asked Answered
A

3

5

I'm curious if there is anyone using Laravel since version 3 running into problems setting cookies in various version of IE when there is an underscore in the cookie name.

I came across this problem with my project (an eCommerce site built on CI). The problem was fixed removing the underscore in cookie name.

While I'm currently porting the project to Laravel, I just want to check if I should remove the underscore from session cookie as well.

Acme answered 22/2, 2013 at 3:11 Comment(0)
D
8

I would definitely recommend removing any underscores from your cookie name, I've been caught out by this a few times in the past whe, and it's easy to pull your hair out trying to figure out what's going on when in the end it's the little underscore gremlin

Dozier answered 22/2, 2013 at 3:24 Comment(2)
Thanks for the feedback. I shall follow PHP style by naming cookie similar to PHPSESSION, without underscore. Thanks.Acme
Unfortunately, I fails to see way to close this question. I tried to vote up your answer and it said I need 15 reputation to do so. I have only 6 at the moment, I'm new here :-)Acme
D
1

It's better practice to use periods instead of underscores in cookie names.

Dahlia answered 22/2, 2013 at 3:27 Comment(1)
Periods in name part get converted to underscore by php on read.Abampere
I
0

Basically you dont need the underscore - so just remove it. Why have a risk at all, when you can have zero risk by removing it :)

Isar answered 22/2, 2013 at 6:11 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.