#28850 [Opn->Bgs]: Passing 0 as expire in setcookie is not the same as passing nothing

From: Date: Mon, 21 Jun 2004 22:45:00 +0000
Subject: #28850 [Opn->Bgs]: Passing 0 as expire in setcookie is not the same as passing nothing
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-61186@lists.php.net to get a copy of this message
ID: 28850 Updated by: iliaa@php.net Reported By: fromphpnet at blaksaga dot com -Status: Open +Status: Bogus Bug Type: Session related Operating System: Linux PHP Version: 4.3.7 New Comment: Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php If you want the value to default to whatever PHP defaults to pass NULL. Previous Comments: ------------------------------------------------------------------------ [2004-06-20 03:36:08] fromphpnet at blaksaga dot com 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 this bug report at http://bugs.php.net/?id=28850&edit=1

« previous php.bugs (#61186) next »