Page MenuHomePhorge

D4650.1775295002.diff
No OneTemporary

Authored By
Unknown
Size
3 KB
Referenced Files
None
Subscribers
None

D4650.1775295002.diff

diff --git a/lib/ext/Syncroton/Server.php b/lib/ext/Syncroton/Server.php
--- a/lib/ext/Syncroton/Server.php
+++ b/lib/ext/Syncroton/Server.php
@@ -147,6 +147,10 @@
if (!$response) {
$response = $command->getResponse();
}
+
+ if ($response === null) {
+ header('Content-Length: 0');
+ }
} catch (Syncroton_Exception_ProvisioningNeeded $sepn) {
if ($this->_logger instanceof Zend_Log)
$this->_logger->info(__METHOD__ . '::' . __LINE__ . " provisioning needed");
diff --git a/tests/Sync/Sync/EmailTest.php b/tests/Sync/Sync/EmailTest.php
--- a/tests/Sync/Sync/EmailTest.php
+++ b/tests/Sync/Sync/EmailTest.php
@@ -112,29 +112,7 @@
$this->assertSame('test sync', $xpath->query("{$root}/ns:ApplicationData/Email:Subject")->item(0)->nodeValue);
// List the rest of the mail
- $request = <<<EOF
- <?xml version="1.0" encoding="utf-8"?>
- <!DOCTYPE AirSync PUBLIC "-//AIRSYNC//DTD AirSync//EN" "http://www.microsoft.com/">
- <Sync xmlns="uri:AirSync" xmlns:AirSyncBase="uri:AirSyncBase">
- <Collections>
- <Collection>
- <SyncKey>{$syncKey}</SyncKey>
- <CollectionId>{$folderId}</CollectionId>
- <DeletesAsMoves>1</DeletesAsMoves>
- <GetChanges>1</GetChanges>
- <Options>
- <FilterType>0</FilterType>
- <Conflict>1</Conflict>
- <BodyPreference xmlns="uri:AirSyncBase">
- <Type>2</Type>
- <TruncationSize>51200</TruncationSize>
- <AllOrNone>0</AllOrNone>
- </BodyPreference>
- </Options>
- </Collection>
- </Collections>
- </Sync>
- EOF;
+ $request = preg_replace('|<SyncKey>\d</SyncKey>|', "<SyncKey>{$syncKey}</SyncKey>", $request);
$response = $this->request($request, 'Sync');
@@ -154,6 +132,24 @@
$this->assertStringMatchesFormat("{$folderId}::%d", $xpath->query("{$root}/ns:ServerId")->item(0)->nodeValue);
$this->assertSame('sync test with attachment', $xpath->query("{$root}/ns:ApplicationData/Email:Subject")->item(0)->nodeValue);
+ // Test the empty Sync response
+ $request = preg_replace('|<SyncKey>\d</SyncKey>|', "<SyncKey>{$syncKey}</SyncKey>", $request);
+
+ $response = $this->request($request, 'Sync');
+
+ print_r($response->getHeaders());
+
+ // According to https://learn.microsoft.com/en-us/openspecs/exchange_server_protocols/ms-ascmd/b4b366a5-7dfb-45a9-a256-af8fa7c53400
+ // the empty response should look like this
+ //
+ // HTTP/1.1 200 OK
+ // Date: Fri, 10 Apr 2009 20:32:39 GMT
+ // Content-Length: 0
+
+ $this->assertSame(200, $response->getStatusCode());
+ $this->assertSame('', (string) $response->getBody());
+ $this->assertSame(['0'], $response->getHeader('Content-Length'));
+
return $syncKey;
}
diff --git a/tests/SyncTestCase.php b/tests/SyncTestCase.php
--- a/tests/SyncTestCase.php
+++ b/tests/SyncTestCase.php
@@ -360,16 +360,15 @@
return $xpath;
}
-
/**
* adapter for phpunit < 9
*/
- protected function assertMatchesRegularExpression($arg1, $arg2)
+ public static function assertMatchesRegularExpression(string $arg1, string $arg2, string $message = ''): void
{
if (method_exists("PHPUnit\Framework\TestCase", "assertMatchesRegularExpression")) {
- parent::assertMatchesRegularExpression($arg1, $arg2);
+ parent::assertMatchesRegularExpression($arg1, $arg2, $message);
} else {
- parent::assertRegExp($arg1, $arg2);
+ parent::assertRegExp($arg1, $arg2, $message);
}
}
}

File Metadata

Mime Type
text/plain
Expires
Sat, Apr 4, 9:30 AM (9 h, 45 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
18828805
Default Alt Text
D4650.1775295002.diff (3 KB)

Event Timeline