Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions lib/Horde/ActiveSync/Imap/Adapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -1218,15 +1218,23 @@ protected function _doQuery(array $query, array $options, bool $deepTraversal):
* is not yet authenticated at the time of object creation.
*
* @return Horde_Imap_Client_Base
* @throws Horde_ActiveSync_Exception
* @throws Horde_Exception_AuthenticationFailure
*/
protected function _getImapOb()
{
$message = 'EMERGENCY - Unable to obtain the IMAP Client';

try {
return $this->_imap->getImapOb();
$imap = $this->_imap->getImapOb();
Comment thread
TDannhauer marked this conversation as resolved.
} catch (Horde_ActiveSync_Exception $e) {
throw new Horde_Exception_AuthenticationFailure('EMERGENCY - Unable to obtain the IMAP Client');
throw new Horde_Exception_AuthenticationFailure($message, 0, $e);
}
Comment thread
TDannhauer marked this conversation as resolved.

if (empty($imap)) {
throw new Horde_Exception_AuthenticationFailure($message);
}
Comment thread
TDannhauer marked this conversation as resolved.

return $imap;
}

/**
Expand Down
12 changes: 12 additions & 0 deletions test/unit/Horde/ActiveSync/ImapAdapterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,18 @@ public function testPingUsesPingWatermarkNotSyncModseq()
$this->assertEquals(6000, $folder->pingModseq());
}

public function testPingThrowsAuthenticationFailureWhenImapClientIsNull()
{
$adapter = new Horde_ActiveSync_Imap_Adapter([
'factory' => $this->_imapFactoryFixture(null),
]);
$folder = new Horde_ActiveSync_Folder_Imap('INBOX', Horde_ActiveSync::CLASS_EMAIL);

$this->expectException(\Horde_Exception_AuthenticationFailure::class);

$adapter->ping($folder);
}

public function testBug13711()
{
Bug13711Fixtures::setActiveSyncProtocolVersion('14.1');
Expand Down