Changes of Revision 4

kolab-syncroton.spec Changed
x
 
1
@@ -36,7 +36,7 @@
2
 %global _ap_sysconfdir %{_sysconfdir}/%{httpd_name}
3
 
4
 Name:           kolab-syncroton
5
-Version:        2.3.22
6
+Version:        2.3.23
7
 Release:        1%{?dist}
8
 Summary:        ActiveSync for Kolab Groupware
9
 
10
debian.changelog Changed
11
 
1
@@ -1,3 +1,9 @@
2
+kolab-syncroton (2.3.23-0~kolab1) unstable; urgency=low
3
+
4
+  * Release version 2.3.23
5
+
6
+ -- Christian Mollekopf <mollekopf@apheleia-it.ch>  Wed, 19 Apr 2023 15:13:40 +0200
7
+
8
 kolab-syncroton (2.3.22-1~kolab1) unstable; urgency=low
9
 
10
   * Fixed timezone issue
11
kolab-syncroton-2.3.22.tar.gz/composer.json-dist -> kolab-syncroton-2.3.23.tar.gz/composer.json-dist Changed
9
 
1
@@ -23,6 +23,6 @@
2
         "zf1s/zend-log": "~1.12.20"
3
     },
4
     "require-dev": {
5
-        "phpunit/phpunit": "^4.8 || ^5.7 || ^6 || ^7"
6
+        "phpunit/phpunit": "^4.8 || ^5.7 || ^6 || ^7 || ^9"
7
     }
8
 }
9
kolab-syncroton-2.3.22.tar.gz/lib/ext/Syncroton/Command/GetAttachment.php -> kolab-syncroton-2.3.23.tar.gz/lib/ext/Syncroton/Command/GetAttachment.php Changed
10
 
1
@@ -49,7 +49,7 @@
2
         if (PHP_SAPI !== 'cli') {
3
             // cache for 3600 seconds
4
             $maxAge = 3600;
5
-            $now = new DateTime(null, new DateTimeZone('UTC'));
6
+            $now = new DateTime('now', new DateTimeZone('UTC'));
7
             header('Cache-Control: private, max-age=' . $maxAge);
8
             header("Expires: " . gmdate('D, d M Y H:i:s', $now->modify("+{$maxAge} sec")->getTimestamp()) . " GMT");
9
             
10
kolab-syncroton-2.3.22.tar.gz/lib/ext/Syncroton/Command/Sync.php -> kolab-syncroton-2.3.23.tar.gz/lib/ext/Syncroton/Command/Sync.php Changed
19
 
1
@@ -465,7 +465,7 @@
2
 
3
                 $wakeupCallback();
4
                 
5
-                $now = new DateTime(null, new DateTimeZone('utc'));
6
+                $now = new DateTime('now', new DateTimeZone('UTC'));
7
 
8
                 foreach($this->_collections as $collectionData) {
9
                     // continue immediately if folder does not exist 
10
@@ -633,7 +633,7 @@
11
 
12
                     if ($hasChanges) {
13
                         // update _syncTimeStamp as $dataController->hasChanges might have spent some time
14
-                        $this->_syncTimeStamp = new DateTime(null, new DateTimeZone('utc'));
15
+                        $this->_syncTimeStamp = new DateTime('now', new DateTimeZone('UTC'));
16
 
17
                         try {
18
                             // fetch entries added since last sync
19
kolab-syncroton-2.3.22.tar.gz/lib/ext/Syncroton/Command/Wbxml.php -> kolab-syncroton-2.3.23.tar.gz/lib/ext/Syncroton/Command/Wbxml.php Changed
10
 
1
@@ -154,7 +154,7 @@
2
             $this->_logger          = Syncroton_Registry::get('loggerBackend');
3
         }
4
         
5
-        $this->_syncTimeStamp = new DateTime(null, new DateTimeZone('UTC'));
6
+        $this->_syncTimeStamp = new DateTime('now', new DateTimeZone('UTC'));
7
         
8
         // set default content type
9
         $this->_headers'Content-Type' = 'application/vnd.ms-sync.wbxml';
10
kolab-syncroton-2.3.22.tar.gz/lib/ext/Syncroton/Model/AEntry.php -> kolab-syncroton-2.3.23.tar.gz/lib/ext/Syncroton/Model/AEntry.php Changed
17
 
1
@@ -40,6 +40,7 @@
2
      * (non-PHPdoc)
3
      * @see Countable::count()
4
      */    
5
+    #\ReturnTypeWillChange
6
     public function count()
7
     {
8
         return count($this->_elements);
9
@@ -49,6 +50,7 @@
10
      * (non-PHPdoc)
11
      * @see IteratorAggregate::getIterator()
12
      */
13
+    #\ReturnTypeWillChange
14
     public function getIterator() 
15
     {
16
         return new ArrayIterator($this->_elements);
17
kolab-syncroton-2.3.22.tar.gz/lib/ext/rtf.php -> kolab-syncroton-2.3.23.tar.gz/lib/ext/rtf.php Changed
17
 
1
@@ -101,6 +101,7 @@
2
     var $cfirst;                // could this be the first character ? so watch out for control symbols
3
 
4
     var $flags = array();       // parser flags
5
+    var $fonttable = array();
6
 
7
     var $queue;                 // every character which is no sepcial char, not belongs to a control word/symbol; is generally considered being 'plain'
8
 
9
@@ -399,7 +400,6 @@
10
                 $this->out.="<group>";
11
         }
12
         if($state == "close") { /* pop from the stack */
13
-            $this->last_flags = $this->flags;
14
             $this->flags = array_pop($this->stack);
15
 
16
             $this->flags"fonttbl_current_write" = ""; // on group close, no more fontdefinition will be written to this id
17
kolab-syncroton-2.3.22.tar.gz/lib/kolab_sync_backend.php -> kolab-syncroton-2.3.23.tar.gz/lib/kolab_sync_backend.php Changed
19
 
1
@@ -919,7 +919,7 @@
2
         $synctime = $synctime->format('Y-m-d H:i:s');
3
         $rcube    = rcube::get_instance();
4
         $db       = $rcube->get_dbh();
5
-        $old_data = $this->modseq$folderid$synctime;
6
+        $old_data = $this->modseq$folderid$synctime ?? null;
7
 
8
         if (empty($old_data)) {
9
             $this->modseq$folderid$synctime = $data;
10
@@ -971,7 +971,7 @@
11
         $synctime = $synctime->format('Y-m-d H:i:s');
12
         $rcube    = rcube::get_instance();
13
         $db       = $rcube->get_dbh();
14
-        $old_data = $this->relations$folderid$synctime;
15
+        $old_data = $this->relations$folderid$synctime ?? null;
16
 
17
         if (empty($old_data)) {
18
             $this->relations$folderid$synctime = $relations;
19
kolab-syncroton-2.3.22.tar.gz/lib/kolab_sync_data.php -> kolab-syncroton-2.3.23.tar.gz/lib/kolab_sync_data.php Changed
46
 
1
@@ -675,7 +675,7 @@
2
      */
3
     protected function getChangesByRelations($folderid, $filter)
4
     {
5
-        if (!$this->tag_categories) {
6
+        if (isset($this->tag_categories) && !$this->tag_categories) {
7
             return;
8
         }
9
 
10
@@ -1011,7 +1011,7 @@
11
         }
12
 
13
         // convert categories into tags, save them after creating an object
14
-        if ($this->tag_categories) {
15
+        if (isset($this->tag_categories) && $this->tag_categories) {
16
             $tags = $data'categories';
17
             unset($data'categories');
18
         }
19
@@ -1045,7 +1045,7 @@
20
             $folder = $this->getFolderObject($object'_mailbox');
21
 
22
             // convert categories into tags, save them after updating an object
23
-            if ($this->tag_categories && array_key_exists('categories', $data)) {
24
+            if (isset($this->tag_categories) && $this->tag_categories && array_key_exists('categories', $data)) {
25
                 $tags = (array) $data'categories';
26
                 unset($data'categories');
27
             }
28
@@ -1077,7 +1077,7 @@
29
             $folder = $this->getFolderObject($object'_mailbox');
30
 
31
             if ($folder && $folder->valid && $folder->delete($object'uid')) {
32
-                if ($this->tag_categories) {
33
+                if (isset($this->tag_categories) && $this->tag_categories) {
34
                     $this->setKolabTags($object'uid', null);
35
                 }
36
 
37
@@ -1522,7 +1522,7 @@
38
         $real_length = $body_length = strlen($body);
39
 
40
         // truncate the body if needed
41
-        if (($truncateAt = $prefs$type'truncationSize') && $body_length > $truncateAt) {
42
+        if (isset($prefs$type) && ($truncateAt = $prefs$type'truncationSize') && $body_length > $truncateAt) {
43
             $body        = mb_strcut($body, 0, $truncateAt);
44
             $body_length = strlen($body);
45
 
46
kolab-syncroton-2.3.22.tar.gz/lib/kolab_sync_data_calendar.php -> kolab-syncroton-2.3.23.tar.gz/lib/kolab_sync_data_calendar.php Changed
35
 
1
@@ -194,7 +194,7 @@
2
             if ($timezone && ($tz_name = $timezone->getName()) != 'UTC') {
3
                 $tzc = kolab_sync_timezone_converter::getInstance();
4
 
5
-                if ($tz_name = $tzc->encodeTimezone($tz_name)) {
6
+                if ($tz_name = $tzc->encodeTimezone($tz_name, $event'start'->format('Y-m-d'))) {
7
                     $result'timezone' = $tz_name;
8
                 }
9
             }
10
@@ -236,10 +236,16 @@
11
                 break;
12
 
13
             case 'sensitivity':
14
+                if (empty($value)) {
15
+                    continue;
16
+                }
17
                 $value = intval($this->sensitivityMap$value);
18
                 break;
19
 
20
             case 'free_busy':
21
+                if (empty($value)) {
22
+                    continue;
23
+                }
24
                 $value = $this->busyStatusMap$value;
25
                 break;
26
 
27
@@ -374,6 +380,7 @@
28
                 $timezone = new DateTimeZone($timezone);
29
             }
30
             catch (Exception $e) {
31
+                $this->logger->warn('Failed to convert the timezone information. UID: ' . $event'uid' . 'Timezone: ' . $data->timezone);
32
                 $timezone = null;
33
             }
34
         }
35
kolab-syncroton-2.3.22.tar.gz/lib/kolab_sync_data_email.php -> kolab-syncroton-2.3.23.tar.gz/lib/kolab_sync_data_email.php Changed
20
 
1
@@ -93,6 +93,9 @@
2
      */
3
     protected $folderType = Syncroton_Command_FolderSync::FOLDERTYPE_MAIL_USER_CREATED;
4
 
5
+    private $lastsync_folder = null;
6
+    private $lastsync_time = null;
7
+
8
 
9
     /**
10
      * the constructor
11
@@ -350,7 +353,7 @@
12
         $result'contentClass' = 'urn:content-classes:message';
13
 
14
         // Categories (Tags)
15
-        if ($this->tag_categories) {
16
+        if (isset($this->tag_categories) && $this->tag_categories) {
17
             // convert kolab tags into categories
18
             $result'categories' = $this->getKolabTags($message);
19
         }
20
kolab-syncroton-2.3.22.tar.gz/lib/kolab_sync_timezone_converter.php -> kolab-syncroton-2.3.23.tar.gz/lib/kolab_sync_timezone_converter.php Changed
165
 
1
@@ -57,6 +57,14 @@
2
         )
3
     );
4
 
5
+
6
+    protected $_legacyTimezones = array(
7
+        # This is an outdated timezone that outlook keeps sending because of an outdate timezone database on windows
8
+        'Lv///0kAcgBhAG4AIABTAHQAYQBuAGQAYQByAGQAIABUAGkAbQBlAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkABAADABcAOwA7AOcDAAAAAEkAcgBhAG4AIABEAGEAeQBsAGkAZwBoAHQAIABUAGkAbQBlAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAwAEAAAAAAAAAAAAxP///w==' => array(
9
+            'Asia/Tehran' => '+0330'
10
+        )
11
+    );
12
+
13
     /**
14
      * don't use the constructor. Use the singleton.
15
      *
16
@@ -140,6 +148,9 @@
17
         if (is_string($_offsets) && isset($this->_knownTimezones$_offsets)) {
18
             $timezones = $this->_knownTimezones$_offsets;
19
         }
20
+        elseif (is_string($_offsets) && isset($this->_legacyTimezones$_offsets)) {
21
+            $timezones = $this->_legacyTimezones$_offsets;
22
+        }
23
         else {
24
             if (is_string($_offsets)) {
25
                 // unpack timezone info to array
26
@@ -151,18 +162,12 @@
27
             }
28
             $this->_setDefaultStartDateIfEmpty($_offsets);
29
 
30
-            $cacheId   = $this->_getCacheId('timezones', $_offsets);
31
-            $timezones = $this->_loadFromCache($cacheId);
32
-
33
-            if (!is_array($timezones)) {
34
-                $timezones = array();
35
-                foreach (DateTimeZone::listIdentifiers() as $timezoneIdentifier) {
36
-                    $timezone = new DateTimeZone($timezoneIdentifier);
37
-                    if (false !== ($matchingTransition = $this->_checkTimezone($timezone, $_offsets))) {
38
-                        $timezones$timezoneIdentifier = $matchingTransition'abbr';
39
-                    }
40
+            $timezones = array();
41
+            foreach (DateTimeZone::listIdentifiers() as $timezoneIdentifier) {
42
+                $timezone = new DateTimeZone($timezoneIdentifier);
43
+                if (false !== ($matchingTransition = $this->_checkTimezone($timezone, $_offsets))) {
44
+                    $timezones$timezoneIdentifier = $matchingTransition'abbr';
45
                 }
46
-                $this->_saveInCache($timezones, $cacheId);
47
             }
48
         }
49
 
50
@@ -224,36 +229,30 @@
51
     {
52
         $this->_setStartDate($_startDate);
53
 
54
-        $cacheId = $this->_getCacheId('offsets', array($_timezone));
55
-
56
-        if (!($offsets = $this->_loadFromCache($cacheId))) {
57
-            $offsets = $this->_getOffsetsTemplate();
58
+        $offsets = $this->_getOffsetsTemplate();
59
 
60
-            try {
61
-                $timezone = new DateTimeZone($_timezone);
62
-            }
63
-            catch (Exception $e) {
64
-                return null;
65
-            }
66
+        try {
67
+            $timezone = new DateTimeZone($_timezone);
68
+        }
69
+        catch (Exception $e) {
70
+            return null;
71
+        }
72
 
73
-            list($standardTransition, $daylightTransition) = $this->_getTransitionsForTimezoneAndYear($timezone, $this->_startDate'year');
74
+        list($standardTransition, $daylightTransition) = $this->_getTransitionsForTimezoneAndYear($timezone, $this->_startDate'year');
75
 
76
-            if ($standardTransition) {
77
-                $offsets'bias' = $standardTransition'offset'/60*-1;
78
-                if ($daylightTransition) {
79
-                    $offsets = $this->_generateOffsetsForTransition($offsets, $standardTransition, 'standard', $timezone);
80
-                    $offsets = $this->_generateOffsetsForTransition($offsets, $daylightTransition, 'daylight', $timezone);
81
+        if ($standardTransition) {
82
+            $offsets'bias' = $standardTransition'offset'/60*-1;
83
+            if ($daylightTransition) {
84
+                $offsets = $this->_generateOffsetsForTransition($offsets, $standardTransition, 'standard', $timezone);
85
+                $offsets = $this->_generateOffsetsForTransition($offsets, $daylightTransition, 'daylight', $timezone);
86
 
87
-                    //@todo how do we get the standardBias (is usually 0)?
88
-                    //$offsets'standardBias' = ...
89
+                //@todo how do we get the standardBias (is usually 0)?
90
+                //$offsets'standardBias' = ...
91
 
92
-                    $offsets'daylightBias' = ($daylightTransition'offset' - $standardTransition'offset')/60*-1;
93
-                    $offsets'standardHour' -= $offsets'daylightBias' / 60;
94
-                    $offsets'daylightHour' += $offsets'daylightBias' / 60;
95
-                }
96
+                $offsets'daylightBias' = ($daylightTransition'offset' - $standardTransition'offset')/60*-1;
97
+                $offsets'standardHour' -= $offsets'daylightBias' / 60;
98
+                $offsets'daylightHour' += $offsets'daylightBias' / 60;
99
             }
100
-
101
-            $this->_saveInCache($offsets, $cacheId);
102
         }
103
 
104
         return $offsets;
105
@@ -539,7 +538,7 @@
106
         }
107
         else if (is_int($_startDate)) {
108
             $startDateParsed'ts'     = $_startDate;
109
-            $startDateParsed'string' = strftime('%F', $_startDate);
110
+            $startDateParsed'string' = date('Y-m-d', $_startDate);
111
         }
112
         else {
113
             $this->_setDefaultStartDateIfEmpty();
114
@@ -618,8 +617,8 @@
115
         }
116
 
117
         foreach ($transitions as $index => $transition) {
118
-            if (strftime('%Y', $transition'ts') == $_year) {
119
-                if (isset($transitions$index+1) && strftime('%Y', $transitions$index'ts') == strftime('%Y', $transitions$index+1'ts')) {
120
+            if (date('Y', $transition'ts') == $_year) {
121
+                if (isset($transitions$index+1) && date('Y', $transitions$index'ts') == date('Y', $transitions$index+1'ts')) {
122
                     $daylightTransition = $transition'isdst' ? $transition : $transitions$index+1;
123
                     $standardTransition = $transition'isdst' ? $transitions$index+1 : $transition;
124
                 }
125
@@ -636,39 +635,4 @@
126
 
127
         return array($standardTransition, $daylightTransition);
128
     }
129
-
130
-    protected function _getCacheId($_prefix, $_offsets)
131
-    {
132
-        return $_prefix . md5(serialize($_offsets));
133
-    }
134
-
135
-    protected function _loadFromCache($key)
136
-    {
137
-        if ($cache = $this->getCache()) {
138
-            return $cache->get($key);
139
-        }
140
-
141
-        return false;
142
-    }
143
-
144
-    protected function _saveInCache($value, $key)
145
-    {
146
-        if ($cache = $this->getCache()) {
147
-            $cache->set($key, $value);
148
-        }
149
-    }
150
-
151
-    /**
152
-     * Getter for the cache engine object
153
-     */
154
-    protected function getCache()
155
-    {
156
-        if ($this->cache === null) {
157
-            $rcube = rcube::get_instance();
158
-            $cache = $rcube->get_cache_shared('activesync');
159
-            $this->cache = $cache ? $cache : false;
160
-        }
161
-
162
-        return $this->cache;
163
-    }
164
 }
165
kolab-syncroton-2.3.22.tar.gz/tests/body_converter.php -> kolab-syncroton-2.3.23.tar.gz/tests/body_converter.php Changed
13
 
1
@@ -2,11 +2,6 @@
2
 
3
 class body_converter extends PHPUnit\Framework\TestCase
4
 {
5
-    function setUp()
6
-    {
7
-    }
8
-
9
-
10
     function data_html_to_text()
11
     {
12
         return array(
13
kolab-syncroton-2.3.22.tar.gz/tests/message.php -> kolab-syncroton-2.3.23.tar.gz/tests/message.php Changed
13
 
1
@@ -2,11 +2,6 @@
2
 
3
 class message extends PHPUnit\Framework\TestCase
4
 {
5
-    function setUp()
6
-    {
7
-    }
8
-
9
-
10
     /**
11
      * Test message parsing and headers setting
12
      */
13
kolab-syncroton-2.3.22.tar.gz/tests/timezone_converter.php -> kolab-syncroton-2.3.23.tar.gz/tests/timezone_converter.php Changed
182
 
1
@@ -2,69 +2,74 @@
2
 
3
 class timezone_converter extends PHPUnit\Framework\TestCase
4
 {
5
-    function setUp()
6
-    {
7
-    }
8
-
9
-
10
     function test_list_timezones()
11
     {
12
 //        date_default_timezone_set('America/Los_Angeles');
13
 
14
-        $converter = timezone_converter_test::getInstance();
15
+        $converter = kolab_sync_timezone_converter::getInstance();
16
         $output = $converter->getListOfTimezones('AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAoAAAAEAAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAFAAEAAAAAAAAAxP///w==');
17
 
18
         $this->assertTrue(is_array($output));
19
         $this->assertSame(array(), $output);
20
 
21
-        $converter = timezone_converter_test::getInstance();
22
+        $converter = kolab_sync_timezone_converter::getInstance();
23
         $output    = $converter->getListOfTimezones('xP///0MAZQBuAHQAcgBhAGwAIABFAHUAcgBvAHAAZQAgAFMAdABhAG4AZABhAHIAZAAgAFQAaQBtAGUAAAAAAAAAAAAAAAoAAAAFAAMAAAAAAAAAAAAAAEMAZQBuAHQAcgBhAGwAIABFAHUAcgBvAHAAZQAgAEQAYQB5AGwAaQBnAGgAdAAgAFQAaQBtAGUAAAAAAAAAAAAAAAMAAAAFAAIAAAAAAAAAxP///w==');
24
 
25
         $this->assertTrue(is_array($output));
26
         $this->assertTrue(isset($output'Europe/Warsaw'));
27
 
28
-        $converter = timezone_converter_test::getInstance();
29
+        $converter = kolab_sync_timezone_converter::getInstance();
30
         $output    = $converter->getListOfTimezones('4AEAAFAAYQBjAGkAZgBpAGMAIABTAHQAYQBuAGQAYQByAGQAIABUAGkAbQBlAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAsAAAABAAIAAAAAAAAAAAAAAFAAYQBjAGkAZgBpAGMAIABEAGEAeQBsAGkAZwBoAHQAIABUAGkAbQBlAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAACAAIAAAAAAAAAxP///w==');
31
 
32
         $this->assertTrue(is_array($output));
33
         $this->assertTrue(isset($output'America/Los_Angeles'));
34
 
35
-        $converter = timezone_converter_test::getInstance();
36
-        $output = $converter->getListOfTimezones('Lv///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkAAwADABcAOwA7AOcDAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAgAEAAAAAAAAAAAAxP///w==');
37
+        $converter = kolab_sync_timezone_converter::getInstance();
38
+        $output = $converter->getListOfTimezones('Lv///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==');
39
 
40
         $this->assertTrue(is_array($output));
41
         $this->assertTrue(isset($output'Asia/Tehran'));
42
-    }
43
-
44
-    function test_get_timezone()
45
-    {
46
-        date_default_timezone_set('America/Los_Angeles');
47
 
48
-        $converter = timezone_converter_test::getInstance();
49
-        $datetime  = new DateTime('2017-01-01T12:00:00Z');
50
+        # As seen in outlook
51
+        $converter = kolab_sync_timezone_converter::getInstance();
52
+        $output = $converter->getListOfTimezones('Lv///0kAcgBhAG4AIABTAHQAYQBuAGQAYQByAGQAIABUAGkAbQBlAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkABAADABcAOwA7AOcDAAAAAEkAcgBhAG4AIABEAGEAeQBsAGkAZwBoAHQAIABUAGkAbQBlAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAwAEAAAAAAAAAAAAxP///w==');
53
 
54
-        $offsets = $converter->getOffsetsForTimezone('UTC', $datetime);
55
-        $output  = $converter->getTimezone($offsets, 'UTC');
56
-
57
-        $this->assertSame('UTC', $output);
58
+        $this->assertTrue(is_array($output));
59
+        $this->assertTrue(isset($output'Asia/Tehran'));
60
+    }
61
 
62
-        $offsets = $converter->getOffsetsForTimezone('Europe/Warsaw', $datetime);
63
-        $output  = $converter->getTimezone($offsets, 'Europe/Warsaw');
64
+    function data_get_timezone()
65
+    {
66
+        return 
67
+            'UTC',
68
+            'Europe/Warsaw',
69
+            'Europe/Zurich',
70
+            'America/Los_Angeles',
71
+            'Asia/Tehran',
72
+        ;
73
+    }
74
 
75
-        $this->assertSame('Europe/Warsaw', $output);
76
+    /**
77
+     * @dataProvider data_get_timezone
78
+     */
79
+    function test_get_timezone($tzName)
80
+    {
81
+        date_default_timezone_set('America/Los_Angeles');
82
 
83
-        $offsets = $converter->getOffsetsForTimezone('America/Los_Angeles', $datetime);
84
-        $output  = $converter->getTimezone($offsets, 'America/Los_Angeles');
85
+        $converter = kolab_sync_timezone_converter::getInstance();
86
+        $datetime  = '2017-01-01T12:00:00Z';
87
 
88
-        $this->assertSame('America/Los_Angeles', $output);
89
+        $offsets = $converter->getOffsetsForTimezone($tzName, $datetime);
90
+        $output  = $converter->getTimezone($offsets, $tzName);
91
+        $this->assertSame($tzName, $output);
92
     }
93
 
94
     function test_get_offsets_for_timezone()
95
     {
96
         date_default_timezone_set('America/Los_Angeles');
97
 
98
-        $converter = timezone_converter_test::getInstance();
99
-        $datetime  = new DateTime('2017-01-01T12:00:00Z');
100
+        $converter = kolab_sync_timezone_converter::getInstance();
101
+        $datetime  = '2017-01-01T12:00:00Z';
102
 
103
         $output = $converter->getOffsetsForTimezone('UTC', $datetime);
104
 
105
@@ -109,37 +114,55 @@
106
         $this->assertSame($output'daylightWeek', 5);
107
         $this->assertSame($output'daylightHour', 0);
108
 
109
+        //Check before dst change
110
         $output = $converter->getOffsetsForTimezone('Asia/Tehran', $datetime);
111
 
112
         $this->assertSame($output'bias', -210);
113
         $this->assertSame($output'standardBias', 0);
114
         $this->assertSame($output'standardMonth', 9);
115
         $this->assertSame($output'standardWeek', 3);
116
-        $this->assertSame($output'standardDayOfWeek', 3);
117
+        $this->assertSame($output'standardDayOfWeek', 4);
118
         $this->assertSame($output'standardHour', 24);
119
         $this->assertSame($output'daylightBias', -60);
120
         $this->assertSame($output'daylightMonth', 3);
121
         $this->assertSame($output'daylightWeek', 4);
122
-        $this->assertSame($output'daylightDayOfWeek', 2);
123
+        $this->assertSame($output'daylightDayOfWeek', 3);
124
+        $this->assertSame($output'daylightHour', 0);
125
+
126
+        //Check after dst change
127
+        $output = $converter->getOffsetsForTimezone('Asia/Tehran', '2023-01-01T12:00:00Z');
128
+
129
+        $this->assertSame($output'bias', -210);
130
+        $this->assertSame($output'standardBias', 0);
131
+        $this->assertSame($output'standardMonth', 0);
132
+        $this->assertSame($output'standardWeek', 0);
133
+        $this->assertSame($output'standardDayOfWeek', 0);
134
+        $this->assertSame($output'standardHour', 0);
135
+        $this->assertSame($output'daylightBias', 0);
136
+        $this->assertSame($output'daylightMonth', 0);
137
+        $this->assertSame($output'daylightWeek', 0);
138
+        $this->assertSame($output'daylightDayOfWeek', 0);
139
         $this->assertSame($output'daylightHour', 0);
140
     }
141
 
142
     function data_timezone_conversion()
143
     {
144
         return array(
145
-            array('Asia/Tehran', 'Lv///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkAAwADABcAOwA7AOcDAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAgAEAAAAAAAAAAAAxP///w=='),
146
-            array('Pacific/Pago_Pago', 'lAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=='),
147
-            array('Europe/Warsaw', 'xP///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAoAAAAFAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAFAAIAAAAAAAAAxP///w=='),
148
+            //Pre dst change
149
+            array('Asia/Tehran', 'Lv///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkAAgADABcAOwA7AOcDAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAQAEAAAAAAAAAAAAxP///w==', '2021-07-01T12:00:00Z'),
150
+            //Post dst change
151
+            array('Asia/Tehran', 'Lv///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==', '2023-04-01T12:00:00Z'),
152
+            array('Pacific/Pago_Pago', 'lAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==', '2021-07-01T12:00:00Z'),
153
+            array('Europe/Warsaw', 'xP///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAoAAAAFAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAFAAIAAAAAAAAAxP///w==', '2021-07-01T12:00:00Z'),
154
         );
155
     }
156
 
157
     /**
158
      * @dataProvider data_timezone_conversion
159
      */
160
-    function test_timezone_conversion($tz, $expected)
161
+    function test_timezone_conversion($tz, $expected, $datetime)
162
     {
163
-        $datetime  = new DateTime('2021-07-01T12:00:00Z');
164
-        $converter = timezone_converter_test::getInstance();
165
+        $converter = kolab_sync_timezone_converter::getInstance();
166
         $output = $converter->encodeTimezone($tz, $datetime);
167
 
168
         $this->assertSame($expected, $output);
169
@@ -150,12 +173,3 @@
170
         $this->assertTrue(isset($output$tz));
171
     }
172
 }
173
-
174
-class timezone_converter_test extends kolab_sync_timezone_converter
175
-{
176
-    // disable cache
177
-    function getCache()
178
-    {
179
-        return null;
180
-    }
181
-}
182
kolab-syncroton.dsc Changed
17
 
1
@@ -2,7 +2,7 @@
2
 Source: kolab-syncroton
3
 Binary: kolab-syncroton
4
 Architecture: all
5
-Version: 2.3.22-1~kolab1
6
+Version: 2.3.23-1~kolab1
7
 Maintainer: Jeroen van Meeuwen <vanmeeuwen@kolabsys.com>
8
 Uploaders: Jeroen van Meeuwen <vanmeeuwen@kolabsys.com>
9
 Homepage: http://www.kolab.org/
10
@@ -12,5 +12,5 @@
11
 Package-List:
12
  kolab-syncroton deb utils extra
13
 Files:
14
- 00000000000000000000000000000000 0 kolab-syncroton-2.3.22.tar.gz
15
+ 00000000000000000000000000000000 0 kolab-syncroton-2.3.23.tar.gz
16
  00000000000000000000000000000000 0 debian.tar.gz
17