From 94d28beb575c45bd6e30263b2feb95025ace3458 Mon Sep 17 00:00:00 2001 From: Christian Binder Date: Wed, 17 Nov 2010 16:50:12 +0000 Subject: [PATCH] respect max_session_size of -1 correctly (no limit) while reading session files --- phpgwapi/inc/class.egw_session_files.inc.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/phpgwapi/inc/class.egw_session_files.inc.php b/phpgwapi/inc/class.egw_session_files.inc.php index 232a150c64..ade3b3ccdc 100644 --- a/phpgwapi/inc/class.egw_session_files.inc.php +++ b/phpgwapi/inc/class.egw_session_files.inc.php @@ -54,16 +54,20 @@ class egw_session_files return $values; } if (!($max_session_size = ini_get('memory_limit'))) $max_session_size = '16M'; - switch(strtoupper(substr($max_session_size,-1))) + if($max_session_size > 0) { - case 'M': $max_session_size *= 1024*1024; break; - case 'K': $max_session_size *= 1024; break; + switch(strtoupper(substr($max_session_size,-1))) + { + case 'M': $max_session_size *= 1024*1024; break; + case 'K': $max_session_size *= 1024; break; + } + $max_session_size /= 4; // use at max 1/4 of the memory_limit to read sessions, the others get ignored } - $max_session_size /= 4; // use at max 1/4 of the memory_limit to read sessions, the others get ignored while (($file = readdir($dir))) { - if ($file{0} == '.' || filesize($path.'/'.$file) >= $max_session_size) continue; + if ($file{0} == '.') continue; + if ($max_session_size > 0 && filesize($path.'/'.$file) >= $max_session_size) continue; if (substr($file,0,5) != 'sess_' || $session_cache[$file] === false) {