php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #80627 session_get_cookie_params options-array 1st param is what?
Submitted: 2021-01-14 19:59 UTC Modified: 2021-01-14 22:25 UTC
From: maiksweb3 at web dot de Assigned:
Status: Not a bug Package: Documentation problem
PHP Version: 8.0Git-2021-01-14 (Git) OS: Mac OS 11.1
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 this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: maiksweb3 at web dot de
New email:
PHP Version: OS:

 

 [2021-01-14 19:59 UTC] 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 );


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2021-01-14 20:02 UTC] maiksweb3 at web dot de
-Summary: session_get_cookie_params options-array 1st param is 'expires' not 'lifetime' +Summary: session_get_cookie_params options-array 1st param is what?
 [2021-01-14 20:02 UTC] maiksweb3 at web dot de
Updated summary.
 [2021-01-14 21:17 UTC] maiksweb3 at web dot de
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.
 [2021-01-14 21:18 UTC] maiksweb3 at web dot de
-Status: Open +Status: Closed
 [2021-01-14 21:18 UTC] maiksweb3 at web dot de
closed
 [2021-01-14 22:25 UTC] cmb@php.net
-Status: Closed +Status: Not a bug
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 13:01:28 2024 UTC