Bug #14227 Updated: header(); does not overwrite session cookie

From: Date: Mon, 04 Feb 2002 00:33:36 +0000
Subject: Bug #14227 Updated: header(); does not overwrite session cookie
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-79000@lists.php.net to get a copy of this message
ID: 14227 Updated by: chris@k2labs.org -Reported By: joffrey@ne2000.nl +Reported By: chris@k2labs.org Status: Open Bug Type: HTTP related Operating System: Linux 2.4.2-2 PHP Version: 4.0.6 New Comment: This is actually not a bug at all. The header function allows you to write a header, basically giving you the flexibility to write any string into the HTTP headers section. Your Set-Cookie header did actually make it into the HTTP response. If you'll look near the bottom, you can see it. The reason it didn't "overwrite" the other is mostly because it's an entirely different cookie (one named x with no attributes given). When multiple cookies are set, multiple Set-Cookie headers are sent in the response. Though I haven't tested it, I'd be willing to bet that if you were to set a cookie named PHPSESSID instead of x, you would only see one Set-Cookie header for that cookie, and it would have the value and attributes assigned to it last. I hope that helps to explain this behavior. Previous Comments: ------------------------------------------------------------------------ [2001-11-26 06:25:17] joffrey@ne2000.nl <?php session_start(); header("Set-Cookie: x"); ?> does not rewrite the Set-Cookie header, nor does true or fasle as second parameter on header. some header: HTTP/1.1 200 OK Date: Mon, 26 Nov 2001 11:22:46 GMT Server: Apache/1.3.20 (Unix) AuthMySQL/2.20 PHP/4.0.7RC3 mod_ssl/2.8.4 OpenSSL/0.9.6 X-Powered-By: PHP/4.0.7RC3 Set-Cookie: PHPSESSID=018ce45ca4f6950531412d038594cc14; path=/ Expires: Thu, 19 Nov 1981 08:52:00 GMT Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Pragma: no-cache Set-Cookie: x Content-Length: 2297 Content-Disposition: inline; filename=document.pdf Connection: close Content-Type: application/pdf feature or bug? :) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=14227&edit=1

« previous php.dev (#79000) next »