|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #10282 session_set_cookie_params(time()) is setting wrong time
Submitted: 2001-04-11 06:07 UTC Modified: 2001-04-11 12:06 UTC
From: tobias dot fritz at gmx dot net Assigned:
Status: Closed Package: Session related
PHP Version: 4.0.4pl1 OS: Red Hat Linux 7.0
Private report: No CVE-ID: None
 [2001-04-11 06:07 UTC] tobias dot fritz at gmx dot net
I wrote the following small script :

$user = "libo";
session_register ("user");
setcookie ("TestCookie", "lalala", time());

if I do a telnet to port 80 on the machine where the script is save I get the following result:

GET /tests/test.php HTTP/1.1
Host: lala

HTTP/1.1 200 OK
Date: Wed, 11 Apr 2001 09:58:21 GMT
Server: Apache/1.3.14 (Unix) mod_mp3/0.6 tomcat/1.0 PHP/4.0.4pl1 mod_ssl/2.7.1 OpenSSL/0.9.6
X-Powered-By: PHP/4.0.4pl1
Set-Cookie: PHPSESSID=82b5fe22428248792d7500dd051a76b6; expires=Tue, 20-Jul-32 19:56:52 GMT; path=/
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Set-Cookie: TestCookie=lalala; expires=Wed, 11-Apr-01 09:58:26 GMT
Transfer-Encoding: chunked
Content-Type: text/html

like you can see, the setcookie ("TestCookie", "lalala", time()); is setting the right time while session_set_cookie_params(time()); is setting a really strange time ...


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2001-04-11 12:06 UTC]
The first parameter is relative to the current time. Hence, common applications use an absolute value like 3600 there, so that the cookie exists for a specific amount of time.
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Mon Jun 01 12:01:27 2020 UTC