Welcome Guest, Not a member yet? Register   Sign In
$_COOKIE[x] disappears
#6

(This post was last modified: 12-26-2018, 11:18 AM by richb201.)

I tried this:
           if(isset($_COOKIE['TestCookie'])){
                   unset($_COOKIE['TestCookie']);
                   $res = setcookie('TestCookie', '', time() - 3600); //delete
                   $json=json_encode(html_escape("empty"));
                   header('Content-type: application/json');
                   header("Access-Control-Allow-Origin: *");
                   echo ($json);
                   exit;
               }
               else {
                   setcookie("TestCookie");
               }
Never mind the $json stuff. I am setting the cookie but if I stop at the line right after the setcookie(), it is not set. Then at the next iteration (really a completely new instance) I stop the code at the isset(), and I can see that there is no TestCookie in $_COOKIE. 

Seems like my debugger (xdebug under phpStorm) is not accurately showing the value of $_COOKIE. Is there any Linux CL utility to see what cookies are set? It seems that there is some type of delay with cookies?
proof that an old dog can learn new tricks
Reply


Messages In This Thread
$_COOKIE[x] disappears - by richb201 - 12-24-2018, 07:00 AM
RE: $_COOKIE[x] disappears - by dave friend - 12-24-2018, 09:15 AM
RE: $_COOKIE[x] disappears - by richb201 - 12-25-2018, 11:20 PM
RE: $_COOKIE[x] disappears - by dave friend - 12-26-2018, 08:26 AM
RE: $_COOKIE[x] disappears - by InsiteFX - 12-26-2018, 09:33 AM
RE: $_COOKIE[x] disappears - by richb201 - 12-26-2018, 10:36 AM
RE: $_COOKIE[x] disappears - by richb201 - 12-26-2018, 11:17 AM
RE: $_COOKIE[x] disappears - by InsiteFX - 12-26-2018, 12:58 PM
RE: $_COOKIE[x] disappears - by richb201 - 12-26-2018, 01:43 PM
RE: $_COOKIE[x] disappears - by richb201 - 12-27-2018, 07:59 AM



Theme © iAndrew 2016 - Forum software by © MyBB