Bug #16626 Updated: Only last cookie set

From: Date: Fri, 26 Apr 2002 20:00:46 +0000
Subject: Bug #16626 Updated: Only last cookie set
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-6165@lists.php.net to get a copy of this message
ID: 16626 Updated by: alex.noffe@x-project.net Reported By: svein.olav@bjerkeset.com Status: Open Bug Type: Apache2 related Operating System: RedHat 7.2 (kernel 2.4.18) i386 PHP Version: 4.2.0 New Comment: Yeap I have the same problem ... Very interessting is, sometimes works. For Example: I have written a Bulletin Board, so I can't Login (with Cookie) my wife have no problem ... I don't know why. Previous Comments: ------------------------------------------------------------------------ [2002-04-25 00:44:01] cpr@hal-9000.net I just want to add, that this is a apache 2.0 compatiblity bug, I'm sure you all tested this out on apache 1.3.24 and it works fine for me. so I think with the shtml bugs that apache is having this could be included with that issue. ------------------------------------------------------------------------ [2002-04-24 15:13:00] svein.olav@bjerkeset.com I can confirm that the replacement function for setcookie by cabel-s@panic.com (send_htCookie) just sets the last cookie in the HTTP response header on my system ------------------------------------------------------------------------ [2002-04-24 14:13:58] cabel-s@panic.com I filed bug #16803 to expand on the header() problem. ------------------------------------------------------------------------ [2002-04-24 13:54:39] cabel-s@panic.com Now I know what "don't use this on a production server" means. :) Strangely, this bug also seems to affect header(). As a result of this bug, we replaced setcookie() with our own routine to write out cookies via header(). However, still, only one cookie (the last one) is being printed in the HTTP response headers (when I sniff the packets being sent). It's very strange... Here's the code we used to replace setcookie(). function send_htCookie() { $vars=array('varname','varval','expire','path','domain','secure'); for ($i=0;$i<func_num_args();$i++) { ${$vars[$i]}=func_get_arg($i); } if (!$varname) { return false; } $COOKIE = "Set-Cookie: $varname=$varval"; if (isset($expire)) { $COOKIE .= "; EXPIRES=$expire";} if (isset($domain)) { $COOKIE .= "; DOMAIN=$domain"; } if (isset($path)) { $COOKIE .= "; PATH=$path"; } if (isset($secure) && $secure>0) { $COOKIE .= "; SECURE"; } header($COOKIE); return true; } Can anyone confirm that this, too, doesn't work for them? I'll do more testing in the meantime... ------------------------------------------------------------------------ [2002-04-23 09:56:19] cpr@hal-9000.net I get the same problem on FreeBSD 4.5 with Apache 2. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/16626 -- Edit this bug report at http://bugs.php.net/?id=16626&edit=1

« previous php.bugs (#6165) next »