From a98f79532de302e01b4133289b21f920baefa223 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Wed, 12 Sep 2012 09:57:28 +0200 Subject: Fix is_error() returns wrong result for empty result set --- program/include/rcube_result_index.php | 4 ++++ program/include/rcube_result_thread.php | 2 ++ 2 files changed, 6 insertions(+) diff --git a/program/include/rcube_result_index.php b/program/include/rcube_result_index.php index cd900677e..6a30450b9 100644 --- a/program/include/rcube_result_index.php +++ b/program/include/rcube_result_index.php @@ -64,10 +64,14 @@ class rcube_result_index for ($i=0, $len=count($data); $i<$len; $i++) { $data_item = &$data[$i]; if (preg_match('/^ SORT/i', $data_item)) { + // valid response, initialize raw_data for is_error() + $this->raw_data = ''; $data_item = substr($data_item, 5); break; } else if (preg_match('/^ (E?SEARCH)/i', $data_item, $m)) { + // valid response, initialize raw_data for is_error() + $this->raw_data = ''; $data_item = substr($data_item, strlen($m[0])); if (strtoupper($m[1]) == 'ESEARCH') { diff --git a/program/include/rcube_result_thread.php b/program/include/rcube_result_thread.php index 889a27fc3..f8b0872f8 100644 --- a/program/include/rcube_result_thread.php +++ b/program/include/rcube_result_thread.php @@ -64,6 +64,8 @@ class rcube_result_thread // ...skip unilateral untagged server responses for ($i=0, $len=count($data); $i<$len; $i++) { if (preg_match('/^ THREAD/i', $data[$i])) { + // valid response, initialize raw_data for is_error() + $this->raw_data = ''; $data[$i] = substr($data[$i], 7); break; } -- cgit v1.2.3