#28850 [NEW]: Passing 0 as expire in setcookie is not the same as passing nothing

From: Date: Sun, 20 Jun 2004 01:36:09 +0000
Subject: #28850 [NEW]: Passing 0 as expire in setcookie is not the same as passing nothing
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-61105@lists.php.net to get a copy of this message
From: fromphpnet at blaksaga dot com Operating system: Linux PHP version: 4.3.7 PHP Bug Type: Session related Bug description: Passing 0 as expire in setcookie is not the same as passing nothing Description: ------------ The overall jist of the problem is this. I want to be able to set a cookie and specify the domain and path WITHOUT setting an expiration (making the cookie get killed when the browser is closed). This is what the documentation for setcookie states: All the arguments except the name argument are optional. You may also replace an argument with an empty string ("") in order to skip that argument. Because the expire and secure arguments are integers, they cannot be skipped with an empty string, use a zero (0) instead. Unfortunately, using a 0 for expire has different results than when passing nothing. The cookie is not killed at session end when using 0 like it should be. These statements should produce exactly the same results but do not: setcookie ( "blaksaga_cookies" , "enabled", 0 ); setcookie ( "blaksaga_cookies2" , "enabled" ); This is either a bug in the setcookie function or in your documentation. None-the-less, there needs to be some way to skip the expire argument while passing domain and path arguments. -- Edit bug report at http://bugs.php.net/?id=28850&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=28850&r=trysnapshot4 Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=28850&r=trysnapshot5 Fixed in CVS: http://bugs.php.net/fix.php?id=28850&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=28850&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=28850&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=28850&r=needscript Try newer version: http://bugs.php.net/fix.php?id=28850&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=28850&r=support Expected behavior: http://bugs.php.net/fix.php?id=28850&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=28850&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=28850&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=28850&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=28850&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=28850&r=dst IIS Stability: http://bugs.php.net/fix.php?id=28850&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=28850&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=28850&r=float

« previous php.bugs (#61105) next »