Req #68390 [Opn->Dup]: setcookie to override same name cookies

From: Date: Mon, 10 Nov 2014 10:52:30 +0000
Subject: Req #68390 [Opn->Dup]: setcookie to override same name cookies
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-188533@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=68390&edit=1 ID: 68390 Updated by: aharvey@php.net Reported by: coladict at gmail dot com Summary: setcookie to override same name cookies -Status: Open +Status: Duplicate Type: Feature/Change Request Package: *General Issues PHP Version: Irrelevant Block user comment: N Private report: N New Comment: Duplicate of bug #67736 (which links to https://github.com/php/php-src/pull/795, where a lively discussion is taking place on whether this should be changed or not, and if so, how). Previous Comments: ------------------------------------------------------------------------ [2014-11-10 10:45:41] coladict at gmail dot com Description: ------------ The last Set-Cookie header, setting a cookie by the same name, always overrides the data in the browser, but multiple set-cookie headers are send for the same name. This initially caused our proxy server to reject the response, because the header size exceeded the default limit. setcookie() should override previous calls to the same cookie name. It should also issue an E_NOTICE message when overriding a previously called cookie, for easier tracing of problems where a cookie might wrongly be overridden. Test script: --------------- <?php setcookie('randomcookie','olddata'); setcookie('randomcookie','newdata'); Expected result: ---------------- In the response headers as suggested: Set-Cookie:randomcookie=newdata Actual result: -------------- In the response headers as it is now: Set-Cookie:randomcookie=olddata Set-Cookie:randomcookie=newdata ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=68390&edit=1

« previous php.bugs (#188533) next »