From: [EMAIL PROTECTED] Operating system: RedHat 7.2 PHP version: 4.2.0 PHP Bug Type: Apache2 related Bug description: Using header() to set multiple cookies only sets the last cookie.
(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 bug report at http://bugs.php.net/?id=16803&edit=1 -- Fixed in CVS: http://bugs.php.net/fix.php?id=16803&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=16803&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=16803&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=16803&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=16803&r=support Expected behavior: http://bugs.php.net/fix.php?id=16803&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=16803&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=16803&r=submittedtwice