From fd43a92b5d31bab019d9afec1c9846b7ab9291bb Mon Sep 17 00:00:00 2001
From: alecpl <alec@alec.pl>
Date: Thu, 12 Jan 2012 09:53:11 -0500
Subject: [PATCH] - Fix possible infinite loop in buildThreadData()

---
 program/include/rcube_result_thread.php |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/program/include/rcube_result_thread.php b/program/include/rcube_result_thread.php
index 63d54a1..0cfd383 100644
--- a/program/include/rcube_result_thread.php
+++ b/program/include/rcube_result_thread.php
@@ -553,10 +553,12 @@
     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);
+            }
         }
     }
 

--
Gitblit v1.9.1