Doc #80627 [Com]: session_get_cookie_params options-array 1st param is what?
| From: | maiksweb3 at web dot de | Date: | Thu, 14 Jan 2021 21:17:48 +0000 |
| Subject: | Doc #80627 [Com]: session_get_cookie_params options-array 1st param is what? | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-18396@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=80627&edit=1
ID: 80627
Comment by: maiksweb3 at web dot de
Reported by: maiksweb3 at web dot de
Summary: session_get_cookie_params options-array 1st param is
what?
Status: Open
Type: Documentation Problem
Package: Documentation problem
Operating System: Mac OS 11.1
PHP Version: 8.0Git-2021-01-14 (Git)
Block user comment: N
Private report: N
New Comment:
Sorry, i found the problem - i gave setcookie() and session_set_cookie_params() the sane
params/options-array but
setcookie() needs 'expires' with timestamp and
session_set_cookie_params() needs 'lifetime' with secounds..
my fault, should read errors and warnings more carefully ;-)
closed.
Previous Comments:
------------------------------------------------------------------------
[2021-01-14 20:02:18] maiksweb3 at web dot de
Updated summary.
------------------------------------------------------------------------
[2021-01-14 19:59:32] maiksweb3 at web dot de
Description:
------------
---
From manual page: https://php.net/function.session-set-cookie-params
---
Documentation does not have an example for options-array,
especially the key's.
User comment #9 - frank at frankforte dot ca
has a wrong key: 'lifetime'
It triggers error
HP Fatal error: Uncaught ValueError: setcookie(): option "lifetime" is invalid in ...
also 'expires' or 'expire' triggers warning:
PHP Warning: session_set_cookie_params(): Argument #1 ($lifetime_or_options) contains an
unrecognized key "expire" in..
PHP Warning: session_set_cookie_params(): Argument #1 ($lifetime_or_options) contains an
unrecognized key "expires" in..
Or am i wrong?
Test script:
---------------
$cookieOpt = array(
'lifetime' => 18000, // also 'expires' or 'expire' do warning
'path' => '/',
'domain' => $_SERVER[ 'HTTP_HOST' ],
'secure' => TRUE,
'httponly' => TRUE,
'samesite' => 'None'
);
session_set_cookie_params( $cookieOpt );
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=80627&edit=1