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
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: phoenixheart at gmail dot com
New email:
PHP Version: OS:

 

 [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: Fri Jul 18 16:00:02 2025 UTC