1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-11 17:24:46 +02:00

Fix issue processwire/processwire-issues#712 to correct issue with $config->sessionHistory=1; setting not working correctly

This commit is contained in:
Ryan Cramer
2018-09-27 07:39:53 -04:00
parent a1bac571f3
commit e6bcd3e44c

View File

@@ -1199,7 +1199,13 @@ class Session extends Wire implements \IteratorAggregate {
end($history);
$lastKey = key($history);
$nextKey = $lastKey+1;
if($cnt >= $historyCnt) $history = array_slice($history, -1 * ($historyCnt-1), null, true);
if($cnt >= $historyCnt) {
if($historyCnt > 1) {
$history = array_slice($history, -1 * ($historyCnt - 1), null, true);
} else {
$history = array();
}
}
} else {
$nextKey = 0;
}