Scenario: Using ActiveSync client tag many (at least two) email messages with the same new tag (category). The issue does not happen for other object types.
In such a scenario the code would call:
- $tags = kolab_storage_config::get_tags()
- if tag is not listed in $tag create a new one (kolab_storage_config::save() call)
- $tags = kolab_storage_config::get_tags()
- if tag is not listed in $tag create a new one...
Note that in 3. $tags will not contain the tag created in 2. and because there's no other checking for tag existence it will create another relation object with the same name.
Solution: kolab_storage_config::save() and kolab_storage_config::delete() should update internal $tags property which is used for "caching". Note, there's also save_tags() method that uses it.