php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #30221 Cookies & booleans
Submitted: 2004-09-24 17:40 UTC Modified: 2004-09-26 04:24 UTC
From: wescotte at earthlink dot net Assigned:
Status: Closed Package: Documentation problem
PHP Version: 5.0.1 OS: Win XP
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: wescotte at earthlink dot net
New email:
PHP Version: OS:

 

 [2004-09-24 17:40 UTC] wescotte at earthlink dot net
Description:
------------
I was attempting to set a cookie using a boolean. TRUE works correctly as 1 but setting it FALSE would not save a cookie at all.

Reproduce code:
---------------
setcookie("name",FALSE,time()+60*60);

if you print_r($_COOKIE); it won't display name as being in the $_COOKIE array but if you

setcookie("name",TRUE,time()+60*60);

it lists name == 1 in $_COOKIE





Expected result:
----------------
If it's a by design issue it might be a good idea to include this in the docs stating not to use booleans with cookies.



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-09-26 04:24 UTC] aidan@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.

FALSE is the same as '', which is the method described for unsetting a cookie. I've added a note to explain this better.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Sep 10 16:00:01 2025 UTC