#21569 [Opn->Bgs]: PHP can't set cookies after a test with an unset variable

From: Date: Fri, 10 Jan 2003 18:56:40 +0000
Subject: #21569 [Opn->Bgs]: PHP can't set cookies after a test with an unset variable
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-29706@lists.php.net to get a copy of this message
ID: 21569 Updated by: sniper@php.net Reported By: ElfQrin@ElfQrin.com -Status: Open +Status: Bogus Bug Type: Unknown/Other Function Operating System: Windows 2000 only PHP Version: 4.3.0 New Comment: Sorry, but your problem does not imply a bug in PHP itself. For a list of more appropriate places to ask for help using PHP, please visit http://www.php.net/support.php as this bug system is not the appropriate forum for asking support questions. Thank you for your interest in PHP. Previous Comments: ------------------------------------------------------------------------ [2003-01-10 12:55:06] ElfQrin@ElfQrin.com PHP can't set cookies on Windows 2000 systems after testing a non-existing variable. This problem was reported in the following conditions: - Windows 2000 server SP-3 (IIS not installed) - Apache v2.0.43 (confirmed on Apache v1.3.27 as well) - PHP 4.3.0 (confirmed on 4.2.2 and 4.2.3 as well) The problem happens with Windows 2000 only. On Windows 98 with the very same configuration, or on Linux, everything works fine. Try the following code: <? # $test="X"; setcookie("debug","1",time()+60*60*24*30,"",""); if ($test=="") {setcookie("debug","2",time()+60*60*24*30,"","");} setcookie("debug","3",time()+60*60*24*30,"",""); ?> <HTML> <HEAD> <TITLE>w2k/PHP setcookie bug test</TITLE> </HEAD> <BODY> BEGIN<BR> <? echo "Cookie: [".$_COOKIE["debug"]."] (HIT RELOAD)<BR>"; ?> END<BR> </BODY> </HTML> When $test is not set, the cookie "debug" remains set to 1, while when $test is set to any value (including "", an empty string), cookie will be eventually properly set to 3. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=21569&edit=1

« previous php.bugs (#29706) next »