6.0.0-beta1
7/16/25

[#12154] ActiveSync: SQL error with HTC Sensation
Summary ActiveSync: SQL error with HTC Sensation
Queue Horde Framework Packages
Queue Version Git master
Type Bug
State Resolved
Priority 1. Low
Owners mrubinsk (at) horde (dot) org
Requester thomas.jarosch (at) intra2net (dot) com
Created 04/03/2013 (4487 days ago)
Due
Updated 04/04/2013 (4486 days ago)
Assigned 04/04/2013 (4486 days ago)
Resolved 04/04/2013 (4486 days ago)
Github Issue Link
Github Pull Request
Milestone
Patch No

History
04/04/2013 02:47:38 PM Michael Rubinsky State ⇒ Resolved
 
04/04/2013 02:43:46 PM Thomas Jarosch Comment #8 Reply to this comment
Try now?
You implemented the same thing as my patch,
except you squeezed it all in one line. I wanted to
avoid that for readability ;)

Anyhow, I'm pretty sure it will work as I've tested my patch.

04/04/2013 02:41:19 PM Michael Rubinsky Comment #7
State ⇒ Feedback
Reply to this comment
Try now?
04/04/2013 02:41:02 PM Git Commit Comment #6 Reply to this comment
Changes have been made in Git (master):

commit a32b5c055d6b6670e3847f1340e1a87c6bf07860
Author: Michael J Rubinsky <mrubinsk@horde.org>
Date:   Thu Apr 4 10:40:06 2013 -0400

     Another attempt at working around broken HTC clients.

     Bug: 12154

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

http://git.horde.org/horde-git/-/commit/a32b5c055d6b6670e3847f1340e1a87c6bf07860
04/04/2013 02:36:33 PM Michael Rubinsky Comment #5 Reply to this comment
Lovely. So your device doesn't send the User-Agent header *or* the 
User-Agent settings data.

Once again, a spec that exists purely for the author's amusement.
04/04/2013 02:00:14 PM Thomas Jarosch Comment #4
New Attachment: 0001-Proper-fix-for-missing-User-Agent-header-bug-12154.patch Download
Reply to this comment
I've developed and tested the attached patch.

What do you think?

04/04/2013 01:52:30 PM Thomas Jarosch Comment #3 Reply to this comment
Looks like we need to catch this in another place, I'm still getting 
the error.

I'm not sure if the fix before setDeviceInfo() is good enough. 
setDeviceInfo() does an "INSERT INTO" while the error message below 
contains an "UPDATE" SQL statement.

I think the real problem is in setDeviceProperties() since 
setDeviceInfo() already handles empty "$data->userAgent" strings.


Error message:
------------------------------------
2013-04-04T15:39:53+02:00 ERR: HORDE [horde] SQL QUERY FAILED: 
SQLSTATE[23000]: Integrity constraint violation: 19 
horde_activesync_device.device_agent may not be NULL
         UPDATE horde_activesync_device SET device_properties =
           
'a:5:{s:14:"Settings:Model";s:17:"HTCSensationZ710e";s:11:"Settings:OS
           ";s:13:"Android 4.0.3";s:21:"Settings:FriendlyName";s:19:"HTC
           Sensation
           
Z710e";s:13:"Settings:IMEI";s:16:"************3379";s:20:"Settings:Pho
           neNumber";s:13:"Not Available";}', device_agent = NULL 
WHERE device_id
           = 'HTC6C4153F09B63EAC481259E1F2E139' [pid 18297 on line 553 
of "/datastore/DEVEL/horde/framework/Db/lib/Horde/Db/Adapter/Base.php"
------------------------------------

I've also doubled-checked the new code is in place:

# pwd
/var/www/horde/libs/Horde

# ls -al ActiveSync.php
lrwxrwxrwx 1 root root 68 2013-04-03 14:33 ActiveSync.php -> 
/datastore/DEVEL/horde/framework/ActiveSync/lib/Horde/ActiveSync.php

# grep userAgent ActiveSync.php
             $userAgent = $this->_request->getHeader('User-Agent');
             $device->userAgent = empty($userAgent) ? 'Unknown' : $userAgent;

04/03/2013 03:59:34 PM Michael Rubinsky State ⇒ Resolved
 
04/03/2013 03:59:19 PM Git Commit Comment #2 Reply to this comment
Changes have been made in Git (master):

commit 8f52b6b106875d63235f6d06147e897a2a6c57f2
Author: Michael J Rubinsky <mrubinsk@horde.org>
Date:   Wed Apr 3 11:47:58 2013 -0400

     User-Agent header is not required when SETTINGS command is used.

     Add temporary value until the SETTINGS command populates it.
     Bug: 12154

  framework/ActiveSync/lib/Horde/ActiveSync.php |    3 ++-
  1 files changed, 2 insertions(+), 1 deletions(-)

http://git.horde.org/horde-git/-/commit/8f52b6b106875d63235f6d06147e897a2a6c57f2
04/03/2013 12:52:52 PM Thomas Jarosch Assigned to Michael Rubinsky
 
04/03/2013 12:49:00 PM Thomas Jarosch Comment #1
State ⇒ Unconfirmed
Patch ⇒ No
Milestone ⇒
Queue ⇒ Horde Framework Packages
Summary ⇒ ActiveSync: SQL error with HTC Sensation
Type ⇒ Bug
Priority ⇒ 1. Low
Reply to this comment
Hi,

I'm just playing around with ActiveSync, a HTC Sensation phone and the 
code from git master (HEAD).

This is what I get in the logs when I add the account on the phone:

2013-04-03T14:43:16+02:00 ERR: HORDE [horde] SQL QUERY FAILED: 
SQLSTATE[23000]: Integrity constraint violation: 19 
horde_activesync_device.device_agent may not be NULL
         UPDATE horde_activesync_device SET device_properties =
           
'a:5:{s:14:"Settings:Model";s:17:"HTCSensationZ710e";s:11:"Settings:OS
           ";s:13:"Android 4.0.3";s:21:"Settings:FriendlyName";s:19:"HTC
           Sensation
           
Z710e";s:13:"Settings:IMEI";s:16:"************3379";s:20:"Settings:Pho
           neNumber";s:13:"Not Available";}', device_agent = NULL 
WHERE device_id
           = 'HTC6C4153F09B63EAC481259E1F2E139' [pid 474 on line 553 
of "/datastore/DEVEL/horde/framework/Db/lib/Horde/Db/Adapter/Base.php"]


The phone seems to sync fine though.

Cheers,
Thomas

Saved Queries