Edit report at http://bugs.php.net/bug.php?id=51116&edit=1
ID: 51116 User updated by: sailormax at inbox dot lv Reported by: sailormax at inbox dot lv Summary: header replace Set-Cookie as similar header Status: Bogus Type: Feature/Change Request Package: *General Issues Operating System: any PHP Version: 5.2.12 Block user comment: N Private report: N New Comment: I meant: Why "Set-cookie: lang.name" replace "Set-Cookie: sessid"? Logically "Set-cookie: lang.name" should replace other "Set-cookie: lang.name", but not "Set-Cookie: sessid". Am I wrong? Previous Comments: ------------------------------------------------------------------------ [2010-11-24 14:03:52] j...@php.net 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,. ------------------------------------------------------------------------ [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