#22307 [Opn->Fbk]: setcookie() only sets last call

From: Date: Sun, 23 Feb 2003 10:11:10 +0000
Subject: #22307 [Opn->Fbk]: setcookie() only sets last call
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-33989@lists.php.net to get a copy of this message
ID: 22307 Updated by: sniper@php.net Reported By: lee at ricis dot com -Status: Open +Status: Feedback Bug Type: IIS related Operating System: Windows 2000 Server PHP Version: 4.3.0 New Comment: From manual page for header(): "The optional replace parameter indicates whether the header should replace a previous similar header, or add a second header of the same type. By default it will replace, but if you pass in FALSE as the second argument you can force multiple headers of the same type." You should add that to the second call for header() and then it works as you expect. Apache sapi has special case for handling cookies so it doesn't need this.. Previous Comments: ------------------------------------------------------------------------ [2003-02-19 16:07:24] lee at ricis dot com assume the following script: <?php $timer = time() + 3600; header('Set-Cookie: USERID=asdfasdf; expires=' . $timer . '; path=/'); header('Set-Cookie: USERHASH=asd3423423; expires=' . $timer . '; path=/'); ?> php 4.2.3, php 4.3.0, and php 4.3.1 (all on IIS 5.0 on windows 2000 server) all set the USERHASH cookie, but never the USERID cookie. when running this script on Apache 1.3.x and php 4.2.3 on suse linux 8.0 pro, USERID and USERHASH cookies are set. i thought this was fixed with bug #18168 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=22307&edit=1

« previous php.bugs (#33989) next »