Skip to content

Commit d5b86b0

Browse files
committed
Query scope error fixed #153
1 parent d2cbbe6 commit d5b86b0

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/IMAP/Query/Query.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,10 @@ public function get() {
165165
$available_messages = $available_messages->reverse();
166166
}
167167

168-
$available_messages->forPage($this->page, $this->limit)->each(function($msgno, $msglist) use(&$messages, $options) {
169-
$oMessage = new Message($msgno, $msglist, $this->getClient(), $this->getFetchOptions(), $this->getFetchBody(), $this->getFetchAttachment(), $this->getFetchFlags());
168+
$query =& $this;
169+
170+
$available_messages->forPage($this->page, $this->limit)->each(function($msgno, $msglist) use(&$messages, $options, $query) {
171+
$oMessage = new Message($msgno, $msglist, $query->getClient(), $query->getFetchOptions(), $query->getFetchBody(), $query->getFetchAttachment(), $query->getFetchFlags());
170172
switch ($options['message_key']){
171173
case 'number':
172174
$message_key = $oMessage->getMessageNo();
@@ -185,9 +187,7 @@ public function get() {
185187

186188
return $messages;
187189
} catch (\Exception $e) {
188-
$message = $e->getMessage();
189-
190-
throw new GetMessagesFailedException($message);
190+
throw new GetMessagesFailedException($e->getMessage());
191191
}
192192
}
193193

0 commit comments

Comments
 (0)