|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2010-02-22 17:14 UTC] sailormax at inbox dot lv
Description:
------------
function header() has second parameter = replace;
it turned on by default;
in result it replace all previous "Set-cookie:", including Set-cookie of session. Why it do not look at cookie name and domain? By standard header can contain several Set-cookie...
Yes, I can turn off replace, but for what this parameter in result? I think for remove duplicates in header. For remove duplicates like few "Content-type:", "Date:", "Expires:",... and for remove duplicates in few similar by _name, domain and path_ "Set-cookie:".
Reproduce code:
---------------
session_start();
header("Set-cookie: lang.name=en;expires=Wed, 01 Jan 2020 16:59:02 GMT;path=/;");
Expected result:
----------------
in header:
~~~~~~~~~~~~~
Set-Cookie: sessid=efd66810c22e02211ad598d93aff7d211e7b17b7; expires=Thu, 25 Feb 2010 16:59:02 GMT; path=/
Set-cookie: lang.name=en;expires=Wed, 01 Jan 2020 16:59:02 GMT;path=/;
~~~~~~~~~~~~~
all not duplicated cookies
Actual result:
--------------
in header:
~~~~~~~~~~~~~
Set-cookie: lang.name=en;expires=Wed, 01 Jan 2020 16:59:02 GMT;path=/;
~~~~~~~~~~~~~
only last cookie...
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Dec 10 11:00:02 2025 UTC |
If you don't want to replace, pass the 2nd parameter like this: header("Set-cookie: lang.name=en;expires=Wed, 01 Jan 2020 16:59:02 GMT;path=/;",false); The feature exists, so use it,.