Bug #67736 [NEW]: setcookie() not updating existing cookies

From: Date: Fri, 01 Aug 2014 14:02:29 +0000
Subject: Bug #67736 [NEW]: setcookie() not updating existing cookies
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-186923@lists.php.net to get a copy of this message
From: brad at bradb dot net Operating system: Linux (Ubuntu) PHP version: 5.6.0RC3 Package: *General Issues Bug Type: Bug Bug description:setcookie() not updating existing cookies Description: ------------ Multiple calls to setcookie() with the same name are not resulting in the cookie header being updated, but instead appended. So the headers are being returned with multiple cookies of the same name. As there seems to be no standard for which browsers select in this instance, it creates headaches! Also reinstalled 5.5.9 and seeing the same issue, again via the Ubuntu package. It seems to occur with both setcookie() and setrawcookie(). A simple test will show the issue: Here's the output of the test script. Test script: --------------- <?php setcookie("test", "abc"); setcookie("test", "def"); Expected result: ---------------- HTTP/1.1 200 OK Date: Fri, 01 Aug 2014 13:46:05 GMT Server: Apache/2.4.10 (Ubuntu) X-Powered-By: PHP/5.6.0RC2 Set-Cookie: test=def Access-Control-Allow-Origin: * Access-Control-Allow-Methods: POST, GET, OPTIONS, DELETE, PUT, HEAD Access-Control-Allow-Headers: Origin,Content-Type,Accept,Authorization Content-Length: 0 Keep-Alive: timeout=5, max=100 Connection: Keep-Alive Content-Type: text/html; charset=UTF-8 Actual result: -------------- HTTP/1.1 200 OK Date: Fri, 01 Aug 2014 13:46:05 GMT Server: Apache/2.4.10 (Ubuntu) X-Powered-By: PHP/5.6.0RC2 Set-Cookie: test=abc Set-Cookie: test=def Access-Control-Allow-Origin: * Access-Control-Allow-Methods: POST, GET, OPTIONS, DELETE, PUT, HEAD Access-Control-Allow-Headers: Origin,Content-Type,Accept,Authorization Content-Length: 0 Keep-Alive: timeout=5, max=100 Connection: Keep-Alive Content-Type: text/html; charset=UTF-8 -- Edit bug report at https://bugs.php.net/bug.php?id=67736&edit=1 --

« previous php.bugs (#186923) next »