Bug #69006 [Com]: cookie problem

From: Date: Fri, 13 Feb 2015 06:18:28 +0000
Subject: Bug #69006 [Com]: cookie problem
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-190647@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: Ok, so i heed your advice and use mainly 2 functions, correct me if those are not what your were referring to or if there are more which I am still unaware of: var_dump(headers_list()); var_dump(http_response_code()); The headers list printed out fine as it is supposed to. The http_response_code() which I called immediately after setting the sessionID cookie returned int(200), looks like things are fine in php like you mentioned. So the problem probably lies in IE, as I happened to accidentally resolved the issue after noticing the problem is gone after I clicked 'enter' at least 3 times to separate the redirection header from the setcookie function. Apparently, doing echo "\r\n"; will solve the issue as well. Previous Comments: ------------------------------------------------------------------------ [2015-02-11 01:33:54] rasmus@php.net Cookies are super-easy to debug. Just look at the Set-Cookie header in the response. What the browsers are doing is not relevant here. If you have the right cookie name and the expiry is correct, then PHP is doing its job. Anything else has nothing to do with PHP. So, please restate the bug in terms of the Set-Cookie output you are getting and explain why it is not what you expected. ------------------------------------------------------------------------ [2015-02-11 01:13:13] simon_freedom125 at hotmail dot com Ok, I was hoping I did something wrong so I decided to give your method another try. The results were slightly different this time, chrome, mozilla, and IE manage to maintain the session on subsequent click on the same website. But, now all the browser failed to register the extended time which was given to last even after until a browser is closed, like with the following: session_set_cookie_params(time()+3600*24,'/',NULL,TRUE); ------------------------------------------------------------------------ [2015-02-08 13:10:47] simon_freedom125 at hotmail dot com 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. ------------------------------------------------------------------------ [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); ------------------------------------------------------------------------ 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

« previous php.bugs (#190647) next »