php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #33862 Cookie doesnot work
Submitted: 2005-07-26 09:05 UTC Modified: 2005-07-26 09:37 UTC
From: phoenixheart at gmail dot com Assigned:
Status: Not a bug Package: Session related
PHP Version: 4.4.0 OS: RedHat Linux
Private report: No CVE-ID: None
 [2005-07-26 09:05 UTC] phoenixheart at gmail dot com
Description:
------------
setcookie() doesnot function on several machines if 3rd parameter is presented;

Reproduce code:
---------------
setcookie("myCookie","myValue",time() + 3600);

Expected result:
----------------
A cookie named "myCookie" should be created.

Actual result:
--------------
No cookie with name "myCookie" was created. If 3rd param (time() + 3600 or other variable) was presented, then th eabove snip of code does work well.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-07-26 09:37 UTC] rasmus@php.net
99% likely that the times on the server and the machines you tested this on were out of synch.  Relying on users to have their clocks set accurately for short-timeout cookies like this is a bad idea.  Use a session-cookie or a longer-range cookie and embed the actual timeout based on your server's time into the cookie value itself.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Thu Jul 17 14:04:04 2025 UTC