Hello everyone.
I'm working on website with a desktop and mobile versions.
I'm using ThemeKey to switch between desktop and mobile theme.
I'm using the system:session property, and i find something strange.
I have two sessions
array(2) {
["viewactu"]=>
bool(true)
["toDesc"]=>
bool(true)
}
But the value calculatde by ThemeKey of system:session was only
["system:session"]=>
array(1) {
[0]=>
string(1) "1"
}
After searching in the code, I find in themekey.system.inc
function themekey_dummy2session($dummy) {
$filtered_params = array();
if (!empty($_SESSION)) {
foreach ($_SESSION as $key => $value) {
if (is_bool($value)) {
$filtered_params[] = $key . '=' . ($value) ? '1' : '0';
}
elseif (!empty($value) && (is_numeric($value) || is_string($value))) {
$filtered_params[] = $key . '=' . $value;
}
else {
$filtered_params[] = $key;
}
}
}
return count($filtered_params) ? array_unique($filtered_params) : NULL;
}
The problem come with $filtered_params[] = $key . '=' . ($value) ? '1' : '0';
Replacing it by $filtered_params[] = $key . '=' . ( ($value) ? '1' : '0');
And we have as value :
["system:session"]=>
array(2) {
[0]=>
string(10) "viewactu=1"
[1]=>
string(8) "toDesc=1"
}
it work better now.
For people who are in trouble with system:session it can help you !
Comments
Comment #1
mkalkbrenneryou're right. Patch committed to 7.x-2.x and 7.x-3.x.
Comment #2
mkalkbrennerComment #3
mkalkbrennerComment #4
mkalkbrenner