Req #51116 [Opn->Bgs]: header replace Set-Cookie as similar header
| From: | jani@php.net | Date: | Wed, 24 Nov 2010 13:03:52 +0000 |
| Subject: | Req #51116 [Opn->Bgs]: header replace Set-Cookie as similar header | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-156381@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=51116&edit=1
ID: 51116
Updated by: jani@php.net
Reported by: sailormax at inbox dot lv
Summary: header replace Set-Cookie as similar header
-Status: Open
+Status: Bogus
Type: Feature/Change Request
-Package: Feature/Change Request
+Package: *General Issues
Operating System: any
PHP Version: 5.2.12
Block user comment: N
Private report: N
New Comment:
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,.
Previous Comments:
------------------------------------------------------------------------
[2010-02-22 17:14:47] 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...
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=51116&edit=1