#24855 [NEW]: setcookie() doesn't work with header() function

From: Date: Tue, 29 Jul 2003 15:17:10 +0000
Subject: #24855 [NEW]: setcookie() doesn't work with header() function
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-44998@lists.php.net to get a copy of this message
From: tomasz at biznespolska dot pl Operating system: Windows NT 4.0 PHP version: 4.3.2 PHP Bug Type: IIS related Bug description: setcookie() doesn't work with header() function Description: ------------ I'm using Windows NT4 with IIS4.0. I have found that function setcookie() doesn't work (doesn't send cookie) , when header() function is called, somewhere after. When I comment line with header() then it sends cookie to browser, but I'm not able to redirect user to another page. I know, I can use <meta http-equiv="refresh" content="0; url=index.php"> but this is not best soultion. System Windows NT WWW 4.0 build 1381 Build Date May 28 2003 15:06:05 Server API CGI/FastCGI Virtual Directory Support enabled Configuration File (php.ini) Path C:\WINNT40\php.ini PHP API 20020918 PHP Extension 20020429 Zend Extension 20021010 Debug Build no Thread Safety enabled Registered PHP Streams php, http, ftp, compress.zlib Reproduce code: --------------- setcookie('BPKEY', "blah=blah", time()+$_CFG['cookie_lifetime'], '/', 'biznespolska.pl'); header( 'Location: index.php' ); Expected result: ---------------- It should set cookie named BPKEY, and redirect to page index.php Actual result: -------------- Only redirects to page index.php -- Edit bug report at http://bugs.php.net/?id=24855&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=24855&r=trysnapshot4 Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=24855&r=trysnapshot5 Fixed in CVS: http://bugs.php.net/fix.php?id=24855&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=24855&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=24855&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=24855&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=24855&r=support Expected behavior: http://bugs.php.net/fix.php?id=24855&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=24855&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=24855&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=24855&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=24855&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=24855&r=dst IIS Stability: http://bugs.php.net/fix.php?id=24855&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=24855&r=gnused

« previous php.bugs (#44998) next »