php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #33322 I can?t set a cookie
Submitted: 2005-06-13 15:37 UTC Modified: 2005-06-16 18:13 UTC
From: j-pieper at web dot de Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 5.0.4 OS: Fedora Project C3
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: j-pieper at web dot de
New email:
PHP Version: OS:

 

 [2005-06-13 15:37 UTC] j-pieper at web dot de
Description:
------------
I can?t set a cookie in my application. I created a small file with only setting a cookie and controlling the content of $_COOKIE but there is nothing. I also get no error-message.

Reproduce code:
---------------
<?php

error_reporting(E_ALL);

setcookie('foo', 'bar', time()+86400);

var_dump($_COOKIE);

?>

Expected result:
----------------
Somthing like this:
array(1) {
    ["foo"]=>  string(3) "bar"
}

Actual result:
--------------
array(0) { }

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-06-13 15:43 UTC] johannes@php.net
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

Reload the page after setting the cookie and accept 
cookies in your browser. 
 [2005-06-13 20:39 UTC] j-pieper at web dot de
Yeah I read it and I tested a few ways to set a cookie. My Browser (Mozilla Firefox 1.0.4) accepts Cookies and i reloaded the page after setting the Cookie but a cookie won?t be set.
 [2005-06-13 21:24 UTC] j-pieper at web dot de
Update:
-------
When I use the code example from http://de2.php.net/manual/de/function.headers-list.php I do not get the shown result. I get an empty array.
 [2005-06-13 23:03 UTC] sniper@php.net
Works fine for me -> you're doing something wrong.
Please ask further support questions elsewhere, this bug system is not a support forum.

 [2005-06-16 18:13 UTC] j-pieper at web dot de
Okay I found my mistake. It was an small and easy mistake but it took a week to fix it ;-)

Sorry for this "Bug"-Report!
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Dec 03 15:00:01 2025 UTC