summaryrefslogtreecommitdiff
path: root/program/include
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2012-01-12 14:54:21 +0000
committeralecpl <alec@alec.pl>2012-01-12 14:54:21 +0000
commit63b9ff12d2573513c59e347d70de494d2c67a4ce (patch)
treebfa4b28d1fbcddb8515ccce42911c73d78e351f4 /program/include
parentbe431441cb06de48b01fde2baf3ccf04094c0273 (diff)
- Fix possible infinite loop in build_thread_data()
Diffstat (limited to 'program/include')
-rw-r--r--program/include/rcube_imap_cache.php8
1 files changed, 5 insertions, 3 deletions
diff --git a/program/include/rcube_imap_cache.php b/program/include/rcube_imap_cache.php
index ee4e92542..acff14653 100644
--- a/program/include/rcube_imap_cache.php
+++ b/program/include/rcube_imap_cache.php
@@ -1108,10 +1108,12 @@ class rcube_imap_cache
private function build_thread_data($data, &$depth, &$children, $level = 0)
{
foreach ((array)$data as $key => $val) {
- $children[$key] = !empty($val);
- $depth[$key] = $level;
- if (!empty($val))
+ $empty = empty($val) || !is_array($val);
+ $children[$key] = !$empty;
+ $depth[$key] = $level;
+ if (!$empty) {
$this->build_thread_data($val, $depth, $children, $level + 1);
+ }
}
}