6.0.0-beta1
8/10/25

[#14019] Folder rename via activesync is broken
Summary Folder rename via activesync is broken
Queue Synchronization
Queue Version Git master
Type Bug
State Resolved
Priority 1. Low
Owners mrubinsk (at) horde (dot) org
Requester horde (at) albasoft (dot) com
Created 06/19/2015 (3705 days ago)
Due
Updated 06/24/2015 (3700 days ago)
Assigned 06/22/2015 (3702 days ago)
Resolved 06/24/2015 (3700 days ago)
Github Issue Link
Github Pull Request
Milestone
Patch Yes

History
06/24/2015 03:16:36 PM Michael Rubinsky Comment #7
State ⇒ Resolved
Reply to this comment
Fixed, thanks.
06/24/2015 03:16:16 PM Git Commit Comment #6 Reply to this comment
Changes have been made in Git (master):

commit 86f1ab4d50609530f1776b162649a81d63327fd3
Author: horde@albasoft.com <horde@albasoft.com>
Date:   Wed Jun 24 11:15:46 2015 -0400

     Bug: 14019  Remaining fixes for saving renamed folderid to state.

     Signed-off-by: Michael J Rubinsky <mrubinsk@horde.org>

  .../ActiveSync/lib/Horde/ActiveSync/State/Sql.php  |   19 +++++++++++++------
  1 files changed, 13 insertions(+), 6 deletions(-)

http://github.com/horde/horde/commit/86f1ab4d50609530f1776b162649a81d63327fd3
06/22/2015 01:15:43 PM Michael Rubinsky Comment #5
State ⇒ Assigned
Reply to this comment
The sql UPDATE code makes "sync_data" the same for all those 
records, as it doesn't have sync_key into account.
Ah, you are right. While we must change the folderid on all of the 
previous syncstates, this will set everything else the same also. Not 
a huge deal, since the earlier sync states are only used if the device 
has some error and it must revert back to the last known state. While 
this is unlikely to happen in this case (if the error occured, it 
would have occurred prior to being allowed to rename a folder) this 
should be properly fixed.
06/22/2015 09:20:33 AM horde (at) albasoft (dot) com Comment #4 Reply to this comment
Partially committed. The sync_key stuff is not necessary since the 
combination of user, device, and folder is already unique enough. 
I.e., all rows that match that combination must have the folderid 
changed.
In my DB I can see more than one record with same user, device, and 
folder. These are records belonging to consecutive sync_key. But 
"sync_data" is different for each of these records (different SYNC 
requests).

The sql UPDATE code makes "sync_data" the same for all those records, 
as it doesn't have sync_key into account.
06/20/2015 03:34:55 PM Michael Rubinsky Comment #3
State ⇒ Resolved
Assigned to Michael Rubinsky
Reply to this comment
Partially committed. The sync_key stuff is not necessary since the 
combination of user, device, and folder is already unique enough. 
I.e., all rows that match that combination must have the folderid 
changed.
06/20/2015 03:33:26 PM Git Commit Comment #2 Reply to this comment
Changes have been made in Git (master):

commit 8983030f73213dda365e877c66346c0b78d21afc
Author: horde@albasoft.com <horde@albasoft.com>
Date:   Sat Jun 20 11:31:32 2015 -0400

     Bug #14019  Fix unserializing binary field.

     Signed-off-by: Michael J Rubinsky <mrubinsk@horde.org>

  .../ActiveSync/lib/Horde/ActiveSync/State/Sql.php  |   15 ++++++++++++++-
  1 files changed, 14 insertions(+), 1 deletions(-)

http://github.com/horde/horde/commit/8983030f73213dda365e877c66346c0b78d21afc
06/19/2015 03:39:51 PM horde (at) albasoft (dot) com Comment #1
Priority ⇒ 1. Low
State ⇒ Unconfirmed
New Attachment: hordewm5-activesync_RenameFolderBugUpdateState.patch Download
Patch ⇒ Yes
Milestone ⇒
Queue ⇒ Synchronization
Summary ⇒ Folder rename via activesync is broken
Type ⇒ Bug
Reply to this comment
I get these messages when renaming or moving a folder from Outlook2013:

2015-06-10T16:42:09+02:00 WARN: HORDE PHP ERROR: unserialize() expects 
parameter 1 to be string, resource given [pid 17446 on line 185 of 
"/var/www/html/php/horde5-pear/pear/php/Horde/ActiveSync/State/Sql.php"]
2015-06-10T16:42:09+02:00 EMERG: HORDE Call to a member function 
setServerId() on a non-object [pid 17446 on line 186 of 
"/var/www/html/php/horde5-pear/pear/php/Horde/ActiveSync/State/Sql.php"]

Folder rename works, but as a new folder after a foldersync, with 
every message downloaded again.

Problem is in "updateServerIdInState" function in 
"Horde/ActiveSync/State/Sql.php" file.
Unserialize of "sync_data" can't be done with:
     $folder = unserialize($folder);
at least using PostgreSQL as I do. I've found  somewhere else this other way:
     $folder = 
unserialize($columns['sync_data']->binaryToString($result['sync_data']));

And also, "sync_key" (primary key in "horde_activesync_state" table) 
is not taken into account in this code. I think you should get every 
"sync_key" (primary key) and update its "sync_data", to avoid mixing 
"sync_data" from several sync processes.

A patch is attached to clarify.

Saved Queries