Summary | ActiveSync Horde5 php serialize on PostgreSQL |
Queue | Synchronization |
Queue Version | Git master |
Type | Bug |
State | Resolved |
Priority | 1. Low |
Owners | jan (at) horde (dot) org |
Requester | horde (at) albasoft (dot) com |
Created | 11/22/2012 (4608 days ago) |
Due | |
Updated | 11/22/2012 (4608 days ago) |
Assigned | 11/22/2012 (4608 days ago) |
Resolved | 11/22/2012 (4608 days ago) |
Github Issue Link | |
Github Pull Request | |
Milestone | |
Patch | No |
I have updates database schema through admin UI.
On pgsql now 'horde_activesync_state.sync_data' column has changed its
type to 'bytea'.
Device log shows no error an proper coding:
---------------------------
2012-11-22T13:12:14+01:00 DEBUG: O <FolderId/>
2012-11-22T13:12:14+01:00 DEBUG: O <Status>
2012-11-22T13:12:14+01:00 DEBUG: O 1
2012-11-22T13:12:14+01:00 DEBUG: O <Status/>
2012-11-22T13:12:14+01:00 DEBUG: [25426] Saving state: Array
(
[0] => {50ab11b8-f2a8-4b28-88cc-182ec0a80102}61
[1] => Horde_Db_Value_Binary Object
(
[_value:protected] =>
O:34:"Horde_ActiveSync_Folder_Collection":3:{s:10:"*_status";a:0:{}s:12:"*_serverid";s:10:"@Contacts@";s:9:"*_class";s:8:"Contacts";}
)
[2] => androidcxxxxxxxxxx
[3] => 1353586334
[4] => @Contacts@
[5] => user
[6] => 0
)
2012-11-22T13:12:14+01:00 DEBUG: O <Folder/>
2012-11-22T13:12:14+01:00 DEBUG: O <Folders/>
2012-11-22T13:12:14+01:00 DEBUG: O <Synchronize/>
---------------------------
And that log leads to this insert in pgsql sync_data field:
O:34:"Horde_ActiveSync_Folder_Collection":3:{s:10:"\000*\000_status";a:0:{}s:12:"\000*\000_serverid";s:10:"@Contacts@";s:9:"\000*\000_class";s:8:"Contacts";}
Thanks
Assigned to Jan Schneider
State ⇒ Feedback
commit 3834d8c59c06ca5fd75c36d114aefa2b9681b103
Author: Jan Schneider <jan@horde.org>
Date: Thu Nov 22 12:53:19 2012 +0100
[jan] Use binary column for serialized sync state (
Bug #11743)..../ActiveSync/lib/Horde/ActiveSync/State/Sql.php | 19 +++++++++----------
.../14_horde_activesync_binarystatefield.php | 20
++++++++++++++++++++
framework/ActiveSync/package.xml | 6 +++++-
3 files changed, 34 insertions(+), 11 deletions(-)
http://git.horde.org/horde-git/-/commit/3834d8c59c06ca5fd75c36d114aefa2b9681b103
Priority ⇒ 1. Low
Type ⇒ Bug
Summary ⇒ ActiveSync Horde5 php serialize on PostgreSQL
Queue ⇒ Synchronization
Milestone ⇒
Patch ⇒ No
State ⇒ Unconfirmed
default backend.
I have activated email sync with 12.1 version. There are some errors
related to php serialize.
As stated in php serialize manual "return values" [
http://php.net/manual/en/function.serialize.php ]:
"Note that this is a binary string which may include null bytes, and
needs to be stored and handled as such. For example, serialize()
output should generally be stored in a BLOB field in a database,
rather than a CHAR or TEXT field. "
But 'horde_activesync_state.sync_data' column is defined as 'text',
and pgsql ends insertion of data right after the first null found in a
string, storing just a part of the data. Sometimes serialize has to
store object's private members and so the string has nulls.
Either serialize is been called with incorrect data, or it has to be
filtered to avoid nulls when inserting into pgsql table.
This is a device log, where "^@" are NULL bytes:
2012-11-13T01:09:49+01:00 DEBUG: O <Folders>
2012-11-13T01:09:49+01:00 DEBUG: O <Folder>
2012-11-13T01:09:49+01:00 DEBUG: O <FolderType>
2012-11-13T01:09:49+01:00 DEBUG: O Contacts
2012-11-13T01:09:49+01:00 DEBUG: O <FolderType/>
2012-11-13T01:09:49+01:00 DEBUG: O <SyncKey>
2012-11-13T01:09:49+01:00 DEBUG: O
{50a15189-9928-4757-9dcb-06c6c0a80102}46
2012-11-13T01:09:49+01:00 DEBUG: O <SyncKey/>
2012-11-13T01:09:49+01:00 DEBUG: O <FolderId>
2012-11-13T01:09:49+01:00 DEBUG: O @Contacts@
2012-11-13T01:09:49+01:00 DEBUG: O <FolderId/>
2012-11-13T01:09:49+01:00 DEBUG: O <Status>
2012-11-13T01:09:49+01:00 DEBUG: O 1
2012-11-13T01:09:49+01:00 DEBUG: O <Status/>
2012-11-13T01:09:49+01:00 DEBUG: [4162] Saving state: Array
(
[0] => {50a15189-9928-4757-9dcb-06c6c0a80102}46
[1] =>
O:34:"Horde_ActiveSync_Folder_Collection":3:{s:10:"^@*^@_status";a:0:{}s:12:"^@*^@_serverid";s:10:"@Contacts@";s:9:"^@*^@_class";s:8:"Contacts";}
[2] => androidc1261044290
[3] => 1352765389
[4] => @Contacts@
[5] => jlsanz
[6] => 0
)
2012-11-13T01:09:49+01:00 DEBUG: O <Folder/>
2012-11-13T01:09:49+01:00 DEBUG: O <Folders/>
2012-11-13T01:09:49+01:00 DEBUG: O <Synchronize/>
Looking at pgsql table for the above logged insert, only
'O:34:"Horde_ActiveSync_Folder_Collection":3:{s:10:"' gets inserted,
just until the first NULL byte.