Reputation: 1316
How does php script handle session vars if it gets two cookies with PHPSESSIDs ? Does it populates $_SESSION with vars from first PHPSESSID or from last one ? Or just merges them ?
Upvotes: 0
Views: 165
Reputation: 4421
$_COOKIE is an associative array, and the session cookie value would be parsed to that, so the last one wins. However, since browsers update the cookie when a "Set-Cookie" header is sent from the server, the only read reason for this is probably client-side tampering.
Upvotes: 1
Reputation: 655229
There can only be one active session. And it’s the first session ID that has been found in either $_COOKIE
, $_GET
or $_POST
that’s name matches the current session.name value.
Upvotes: 0