|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #22307 setcookie() only sets last call
Submitted: 2003-02-19 16:07 UTC Modified: 2003-03-09 18:56 UTC
Avg. Score:5.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:2 (100.0%)
Same OS:2 (100.0%)
From: lee at ricis dot com Assigned:
Status: No Feedback Package: IIS related
PHP Version: 4.3.0 OS: Windows 2000 Server
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2003-02-19 16:07 UTC] lee at ricis dot com
assume the following script:


$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


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2003-02-23 04:11 UTC]
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..

 [2003-03-09 18:56 UTC]
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.

PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Feb 21 15:01:26 2024 UTC