summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2012-01-12 14:53:11 +0000
committeralecpl <alec@alec.pl>2012-01-12 14:53:11 +0000
commitfd43a92b5d31bab019d9afec1c9846b7ab9291bb (patch)
tree3e8c038f3eb0a58a96f12fdaf895543e4327d122
parent3efe96aec396b95fa8b2cd0df4db1587fcd8cdfe (diff)
- Fix possible infinite loop in buildThreadData()
-rw-r--r--program/include/rcube_result_thread.php8
1 files changed, 5 insertions, 3 deletions
diff --git a/program/include/rcube_result_thread.php b/program/include/rcube_result_thread.php
index 63d54a109..0cfd383eb 100644
--- a/program/include/rcube_result_thread.php
+++ b/program/include/rcube_result_thread.php
@@ -553,10 +553,12 @@ class rcube_result_thread
private function buildThreadData($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->buildThreadData($val, $depth, $children, $level + 1);
+ }
}
}