Jump to content

cookie samesite flag causing warning


KillGorack

Recommended Posts

Hi,

Playing with hardening a little, and implemented samesite flag within a cookie, or at least tried to.

 

Code like:

session_set_cookie_params(0, "/; SameSite=Strict", "domain.com", true, true);
$params = session_get_cookie_params();
session_start();
setcookie("PHPSESSID", session_id(), $params["lifetime"], $params["path"], $params["domain"], $params["secure"], $params["httponly"]);

Warning:

PHP Warning: Cookie paths cannot contain any of the following ',; \t\r\n\013\014' in /homepages/39/d582945504/htdocs/portal-x/inc/cookies.php on line 21

Not sure if it's a huge deal to just leave that out..

  • Like 1
Link to comment
Share on other sites

Thanks for the reply,

I have access to 7.3, but the production server is 7.2. Does this make a difference? This is of course I think because the presence of the semicolon below within the "samesite" attribute.

session_set_cookie_params(0, "/; SameSite=Strict", "domain.com", true, true);

Looking for syntax of that array method. Can you help a guy out with an example?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.