php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #80304 setCookie() doc has given expiry in sec, but shows it as minute
Submitted: 2020-11-01 11:00 UTC Modified: 2020-11-01 11:03 UTC
From: asteroidalaz at gmail dot com Assigned:
Status: Not a bug Package: Documentation problem
PHP Version: 7.4.12 OS: Windows 10
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: asteroidalaz at gmail dot com
New email:
PHP Version: OS:

 

 [2020-11-01 11:00 UTC] asteroidalaz at gmail dot com
Description:
------------
In the documentation of the setCookie() function the doc says that setCookie()'s expiry param takes input as time() + some value, which is in unix seconds, but in its example it takes time() + 60*60 *24 * 30 and comments it as 30 day time perion but the time mentioned is 1/60 of that time period, as it should multiply 60 more to it.
I found that this mistake was multiple time in the documentation, have a look there. And Thanks for your awesome PHP.

Test script:
---------------
setCookie("name","value", "/", time() + 60*60 *24 * 30); # This is 1/60th of 30 days
#it should be
setCookie("name","value", "/", time() + 60*60 *24 * 30 * 60); # One more 60 multiplied


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2020-11-01 11:03 UTC] peehaa@php.net
-Status: Open +Status: Not a bug
 [2020-11-01 11:03 UTC] peehaa@php.net
Not it should not.

time() + 60 * 60 *24 * 30 is 30 days
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 10:01:28 2024 UTC