ID: 14571
Updated by: derick
Reported By: [EMAIL PROTECTED]
Status: Bogus
Bug Type: Documentation problem
Operating System: Linux
PHP Version: 4.1.0
New Comment:

>From the manual: (http://uk.php.net/manual/en/function.setcookie.php)

 Some examples follow how to send cookies:

Example 1. setcookie() send examples

a. setcookie ("TestCookie", "Test Value");
b. setcookie ("TestCookie", $value,time()+3600);  /* expire in 1 hour */
c. setcookie ("TestCookie", $value,time()+3600, "/~rasmus/", ".utoronto.ca", 1);

Examples follow how to delete cookies send in previous example:

Example 2. setcookie() delete examples

a. setcookie ("TestCookie");
// set the expiration date to one hour ago
b. setcookie ("TestCookie", "", time() - 3600);
c. setcookie ("TestCookie", "", time() - 3600, "/~rasmus/", ".utoronto.ca", 1);

When deleting a cookie you should assure that the expiration date is in the past, to 
trigger the removal mechanism in your browser.

Previous Comments:
------------------------------------------------------------------------

[2001-12-18 03:48:17] [EMAIL PROTECTED]

This hasn't changed. setcookie('name','') doesn't remove the cookie, and it never did. 
To remove a cookie, use setcookie with a expire-date in the past, i.e. 
setcookie('name','', time()-10000).

------------------------------------------------------------------------

[2001-12-17 21:36:35] [EMAIL PROTECTED]

The behavoir of the setcookie function changed in 4.1.0 even though no such change was 
documented in the changelog.  This had the effect of disabling an application of mine 
until I figured out what happened.

In PHP <4.1.0, the code:

 setcookie("cookiename","");

would delete the cookie 'cookiename'.

In PHP 4.1.0, this function created a cookie with a null value named cookiename.

I know this is a rather silly change, and you wouldn't expect someone to ever specify 
a blank value in the second argument, but it did cause a short downtime in our website 
 software.  

I posted this on the setcookie() manual page but it was rejected on grounds that it 
was more of a bug report than anything, so I thought I'd post it here.

Thanks 

Sean

------------------------------------------------------------------------



Edit this bug report at http://bugs.php.net/?id=14571&edit=1


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to