Bug #69006 [Com]: cookie problem

From: Date: Sun, 08 Feb 2015 13:10:48 +0000
Subject: Bug #69006 [Com]: cookie problem
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-190531@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=69006&edit=1

 ID:                 69006
 Comment by:         simon_freedom125 at hotmail dot com
 Reported by:        simon_freedom125 at hotmail dot com
 Summary:            cookie problem
 Status:             Feedback
 Type:               Bug
 Package:            Session related
 Operating System:   windows
 PHP Version:        5.6.5
 Block user comment: N
 Private report:     N

 New Comment:

of course I did a session start. Otherwise, I would not be giving a description that it works when a
user did not check the 'remember me'.

Tried your method with session_set_cookie_params( some params), did not work as well. It's not
like I mess with the settings of IE, strange.


Previous Comments:
------------------------------------------------------------------------
[2015-02-08 05:40:38] yohgaki@php.net

Have you tried what I wrote?
Why your test script does not have session_start()?
W/o session_start(), session is useless.

------------------------------------------------------------------------
[2015-02-08 03:34:06] simon_freedom125 at hotmail dot com

Description:
------------
The actual version of php is actually 5.6.3

The session does not persist when I set cookie for the session id to last not until the browser is
closed. example, to last for a day.
When the session id is set to last until the browser is closed, the session start works on
subsequent page request.

Tested on 3 browsers - chrome, mozilla, and IE. This only happens on IE.
realized this problem after upgrading from php 5.4+

I used the session_name function to change the default, so I am not using PHPSESSID. Not sure what
is the actual cause.

Test script:
---------------
session_name('sessionID');
setcookie('sessionID',$sessionID,time()+3600*24,'/',NULL,true);

------------------------------------------------------------------------
[2015-02-08 00:55:27] simon_freedom125 at hotmail dot com

I don't think it is a problem with session_set_cookie_params(). lets say i set 3 different
cookies to last for a day. only the sessionID which I renamed away from the default of PHPSESSID
does not persist.

Just another clearer example. I created a script which allows user to log into their account. A user
check remember me so the script extend the cookie time. A total of 3 cookies named, sessionID, name,
and a random value, with the same expiry time were given to the client browser. Now, everything is
still fine over here.

Bug happens after the user clicked log in and then chose to proceed to another request after being
redirected from the log in page, like a refresh or clicking on another link. when I called
$_COOKIE['sessionID'], undefined call to sessionID error was shown on the screen.
Surprising, only the sessionID cookie was affected. The other 2 can be seen in the browser cookie.
Not opting remember me will solve the problem, which is weird, only on IE.

------------------------------------------------------------------------
[2015-02-07 18:34:43] yohgaki@php.net

Correction.

> Regardless of session.use_strict_mode,

session.use_strict_mode=Off required.

------------------------------------------------------------------------
[2015-02-07 18:32:33] yohgaki@php.net

Regardless of session.use_strict_mode, following code should work

session_name('MYSESS1');
session_id('2342424234242424323423');
session_set_cookie_params( some params);
session_start();
//do something. Copy $_SESSION to other var, if needed.
session_commit();

session_name('MYSESS2');
session_id('abasdfasdasbafdewra');
session_set_cookie_params( some params);
session_start();

------------------------------------------------------------------------


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    https://bugs.php.net/bug.php?id=69006


--
Edit this bug report at https://bugs.php.net/bug.php?id=69006&edit=1


Thread (16 messages)

« previous php.bugs (#190531) next »