#23893 [NEW]: setcookie fails if $_GET value is empty

From: Date: Fri, 30 May 2003 10:05:27 +0000
Subject: #23893 [NEW]: setcookie fails if $_GET value is empty
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-40694@lists.php.net to get a copy of this message
From: info at splendense dot nl Operating system: sunOS PHP version: 4.3.2 PHP Bug Type: Scripting Engine problem Bug description: setcookie fails if $_GET value is empty I'm running php as CGI API and register globals and i'm trying the following script: <?php $something = $_GET["something"]; $value = "this is a value"; if (!setcookie ("TestCookie", $value)) { print ("cookie NOT set!"); } else { print ("cookie set!"); } ?> with the following outputs: 1. www.server.com/script.php?something= outputs: 'cookie set!' 2. www.server.com/script.php outputs: 'cookie NOT set!' 3. www.server.com/script.php?somehting=value outputs: 'cookie set!' 4. www.server.com/script.php?something_else= outputs: 'cookie NOT set!' so if I try to read a variable (can be GET/COOKIE/POST/...) and it is not explicitly specified, even if it's empty, cookies can't be set anymore. I think it has to do with being a CGI API, because on another server where it's installed as apache API I don't have this problem. can anyone verify this? -- Edit bug report at http://bugs.php.net/?id=23893&edit=1 -- Try a CVS snapshot: http://bugs.php.net/fix.php?id=23893&r=trysnapshot Fixed in CVS: http://bugs.php.net/fix.php?id=23893&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=23893&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=23893&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=23893&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=23893&r=support Expected behavior: http://bugs.php.net/fix.php?id=23893&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=23893&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=23893&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=23893&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=23893&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=23893&r=dst IIS Stability: http://bugs.php.net/fix.php?id=23893&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=23893&r=gnused

« previous php.bugs (#40694) next »