Basj
Basj

Reputation: 46381

session-set-cookie-params path non working

I created two files:

// /var/www/blah/index.php (www.example.com/blah/index.php)

session_set_cookie_params(0, '/blah'); 
session_start();   
$_SESSION['hello'] = 1;

and

// /var/www/foo/index.php  (www.example.com/foo/index.php)

session_set_cookie_params(0, '/foo'); 
session_start();   
echo $_SESSION['hello'];

When opening the first, then the second in browser, I get 1.

Why is the same SESSION available in both?

It should not, according to session-set-cookie-params.

Upvotes: 0

Views: 684

Answers (1)

xate
xate

Reputation: 6379

As I said in ##php on freenode:

The browser doesn't respect the session_set_cookie_params() because you have a valid PHPSESSID cookie and your browser keeps regenerating it. (because you visited the page before). Delete all your PHPSESSID cookies and try again.

Upvotes: 3

Related Questions