PHP does not store all variables in session
- by Flurin Juvalta
Dear all
I'm assigning session variables by filling the $_SESSION - Array throughout my script. My problem is, that for some reason not all variables are available in the session.
here is a shortened version of my code for explaining this issue:
session_start();
print_r($_SESSION);
$_SESSION['lang'] = 'de';
$_SESSION['location_id'] = 11;
$_SESSION['region_id'] = 1;
$_SESSION['userid'] = 'eccbc87e4b5ce2fe28308fd9f2a7baf3';
$_SESSION['hash'] = 'dce57f1e3bc6fba32afab93b0c38b662';
print_r($_SESSION);
first call prints something like this:
Array
(
)
Array
(
[lang] => de
[location_id] => 11
[region_id] => 1
[userid] => eccbc87e4b5ce2fe28308fd9f2a7baf3
[hash] => dce57f1e3bc6fba32afab93b0c38b662
)
the second call prints:
Array
(
[lang] => de
[location_id] => 11
[region_id] => 1
)
Array
(
[lang] => de
[location_id] => 11
[region_id] => 1
[userid] => eccbc87e4b5ce2fe28308fd9f2a7baf3
[hash] => dce57f1e3bc6fba32afab93b0c38b662
)
As you can see, the important login information is not stored in the session.
Does anybody has an idea what could be wrong with my session? Thanks for your answers!