Setcookie syntax Google Chrome Setcookie syntax Google Chrome google-chrome google-chrome

Setcookie syntax Google Chrome


I don't think it is something which you could/should solve. The Inspector/Dev tool that you are using is not always right as shown by the other user. There are other cases where the Dev tool is wrong too, like in "network" tool.
You could install an extension like edit this cookie to find out how your cookies are behaving. Although it doesn't help you track across redirects, it helps knowing what cookies are set up and allows you to change it too.


Update

I performed additional tests and came to the same conclusion as Issue 123013 listed below. I think this is just a DevTools bug.

DevTools > Network appears to incorrectly render the date. However, DevTools > Resources correctly displays the date similar to other browsers.

Also, another cookie I created correctly expired. This was reflected in DevTools > Resources but not in DevTools > Network. .

Test Results

setcookie('foo', 'bar', time()+3600, "/", NULL, false, true);Chrome v24.0.1312.57  Resources > Cookies   Thu, 14 Feb 2013 17:08:33 GMT  Network > Cookies     Invalid DateFirefox 18.0.2          Thursday, February 14, 2013 11:59:15 AMIE9 9.0.8112.16421      Thu, 14-Feb-2013 17:06:42 GMT

Finally, to conclude, your syntax appears correct. The message "Invalid Date" looks like a Chrome bug.


I could not replicate this issue with Chrome v24.0.1312.57. I set various test cookies with JavaScript and PHP. Chrome threw no errors and correctly converted the max-age values I passed into a corresponding expires values.

This bug, or something very similar, has been submitted and apparently fixed.

WebKit

Chromium