From: [EMAIL PROTECTED] Operating system: Windows 2000 only PHP version: 4.3.0 PHP Bug Type: Unknown/Other Function Bug description: PHP can't set cookies after a test with an unset variable
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 bug report at http://bugs.php.net/?id=21569&edit=1 -- Try a CVS snapshot: http://bugs.php.net/fix.php?id=21569&r=trysnapshot Fixed in CVS: http://bugs.php.net/fix.php?id=21569&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=21569&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=21569&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=21569&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=21569&r=support Expected behavior: http://bugs.php.net/fix.php?id=21569&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=21569&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=21569&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=21569&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=21569&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=21569&r=dst IIS Stability: http://bugs.php.net/fix.php?id=21569&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=21569&r=gnused