Bug #16803 Updated: Using header() to set multiple cookies only sets the last cookie.

From: Date: Tue, 30 Apr 2002 18:09:57 +0000
Subject: Bug #16803 Updated: Using header() to set multiple cookies only sets the last cookie.
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-6579@lists.php.net to get a copy of this message
ID: 16803 Updated by: kala@pinerecords.com Reported By: cabel-s@panic.com Status: Open Bug Type: Apache2 related Operating System: RedHat 7.2 PHP Version: 4.2.0 New Comment: Hi, just wondering.. is anyone working on a fix at all? I understand this is a rather critical issue. Thanks, Tom Previous Comments: ------------------------------------------------------------------------ [2002-04-24 19:26:34] cabel-s@panic.com Hello! Thanks for your note -- of course I searched first! :) As I say first in my notes, bug #16626 is very similar and may even be the same problem -- it details problems using setcookie() -- but I thought filing this bug would be helpful because it details that the problem also exists with header(), not just setcookie(). Is that not helpful for you guys? If so, let me know, and I'll close this. I searched for all "open" bugs with the string "header", and with PHP version 4.2.0 (since this relates to Apache 2), and found nothing. I'm sorry -- if this IS truly a duplicate bug, I am unable to find its friends right away, but I will keep looking! If I find something, I'll mark it duplicate. ------------------------------------------------------------------------ [2002-04-24 19:17:57] yohgaki@php.net Please _search_ bug db first. There are sevral reports for this. I appreciate if you could search and comment bug # that is active for this bug, then change status to Duplicate. Thank you. ------------------------------------------------------------------------ [2002-04-24 14:09:53] cabel-s@panic.com (Also see Bug #16626) Bug #16626 explains that when using setcookie() with PHP 4.2.0 and Apache 2.0.35, only the LAST call to setcookie() will be actually sent in the HTTP headers -- all previous calls/cookies will be ignored and not sent. This bug expands on this by discovering that the same problem affects the header() call. For example, try running the following test script in PHP 4.2.0 and Apache 2.0.35: -- <?php // Only "three=three" will get sent! header("Set-Cookie: one=one"); header("Set-Cookie: two=two"); header("Set-Cookie: three=three"); // These will both be sent unharmed. header("Set-Monkey: eep"); header("Set-Fish: glug"); // Location gets sent fine... header("Location: http://www.panic.com/"); ?> -- You can verify that ONLY the last cookie ("three") is being sent by either turning on per-cookie ask in your browser, or running a packet sniffer and looking at the HTTP response. In the example above, the HTTP headers look like: [...] X-Powered-By: PHP/4.2.0 Set-Cookie: three=three Set-Money: eep Set-Fish: glug Location: http://www.panic.com/ Content-Length: 0 [...] Thanks for looking into this! ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=16803&edit=1

« previous php.bugs (#6579) next »