summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2012-09-12 09:57:28 +0200
committerAleksander Machniak <alec@alec.pl>2012-09-12 09:57:28 +0200
commitc093dcc391ad886ab815e6e70630c8e252df06ab (patch)
tree7e7386a1215b6423b00f9a8c6bcdc69abf7f9757
parent1e9aa256091f56589e75489deff3259a3586ad1f (diff)
Fix is_error() returns wrong result for empty result set
-rw-r--r--program/include/rcube_result_index.php4
-rw-r--r--program/include/rcube_result_thread.php2
2 files changed, 6 insertions, 0 deletions
diff --git a/program/include/rcube_result_index.php b/program/include/rcube_result_index.php
index cc1615d35..334ec8530 100644
--- a/program/include/rcube_result_index.php
+++ b/program/include/rcube_result_index.php
@@ -61,10 +61,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 214aec217..09fa46522 100644
--- a/program/include/rcube_result_thread.php
+++ b/program/include/rcube_result_thread.php
@@ -61,6 +61,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;
}