php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #18287 setcookie() return value not documented
Submitted: 2002-07-11 17:26 UTC Modified: 2002-07-16 12:52 UTC
From: drfickle at k-lug dot org Assigned:
Status: Closed Package: Documentation problem
PHP Version: 4.2.1 OS: n/a
Private report: No CVE-ID: None
 [2002-07-11 17:26 UTC] drfickle at k-lug dot org
The documentation for setcookie() does not specify what a successful return value should be (0 or 1).

Patches

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-07-11 18:31 UTC] philip@php.net
I get boolean TRUE on success, and boolean FALSE on failure.  Of course failure does not mean the cookie wasn't set, it means the function failed. Like if header info was already sent.

Docs say int is returned, should it be boolean instead?
 [2002-07-11 21:24 UTC] drfickle at k-lug dot org
You are correct, it is indeed a boolean. I was just doing a print on the return value before. Perhaps changing that and including a sentence or two about the condition you mentioned too. Many people might assume that the cookie wasn't sent if they get false returned.

Thanks much.
 [2002-07-16 12:52 UTC] philip@php.net
This bug has been fixed in CVS. You can grab a snapshot of the
CVS version at http://snaps.php.net/. In case this was a documentation 
problem, the fix will show up soon at http://www.php.net/manual/.
In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites.
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Aug 17 03:01:28 2024 UTC