Doc #80304 [Opn->Nab]: setCookie() doc has given expiry in sec, but shows it as minute
Edit report at https://bugs.php.net/bug.php?id=80304&edit=1
ID: 80304
Updated by: peehaa@php.net
Reported by: asteroidalaz at gmail dot com
Summary: setCookie() doc has given expiry in sec, but shows
it as minute
-Status: Open
+Status: Not a bug
Type: Documentation Problem
Package: Documentation problem
Operating System: Windows 10
PHP Version: 7.4.12
Block user comment: N
Private report: N
New Comment:
Not it should not.
time() + 60 * 60 *24 * 30 is 30 days
Previous Comments:
------------------------------------------------------------------------
[2020-11-01 11:00:07] 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
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=80304&edit=1
Thread (2 messages)