6.0.0-beta1
7/6/25

[#12551] Horde_Imap_Client: array_combine() error message
Summary Horde_Imap_Client: array_combine() error message
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 08/08/2013 (4350 days ago)
Due
Updated 08/08/2013 (4350 days ago)
Assigned 08/08/2013 (4350 days ago)
Resolved 08/08/2013 (4350 days ago)
Github Issue Link
Github Pull Request
Milestone
Patch No

History
08/08/2013 08:12:39 PM Michael Rubinsky State ⇒ Resolved
 
08/08/2013 08:11:20 PM Michael Rubinsky Comment #8 Reply to this comment
$imap->fetch($mbox, $query, array('uids' => $search_ret['match']));
That's not good.  There is no 'uids' parameter to fetch(), only 'ids':

http://dev.horde.org/api/master/lib/Imap_Client/classes/Horde_Imap_Client_Base.html#method_fetch
Doh. Thanks for the catch. I had it right in some places, but not others.
08/08/2013 08:06:14 PM Michael Slusarz Comment #7
Taken from Michael Slusarz
State ⇒ Assigned
Reply to this comment
$imap->fetch($mbox, $query, array('uids' => $search_ret['match']));
That's not good.  There is no 'uids' parameter to fetch(), only 'ids':

http://dev.horde.org/api/master/lib/Imap_Client/classes/Horde_Imap_Client_Base.html#method_fetch

08/08/2013 07:29:13 PM Michael Rubinsky Comment #6
State ⇒ Feedback
Reply to this comment
I had fixed something similar before (during the initial sync): 
https://github.com/horde/horde/commit/c61cc7f2a5a3cfb7145510c6eebc75e7a92cbddf

Essentially, the error is thrown when calling something ilke:

$imap->fetch($mbox, $query, array('uids' => $search_ret['match']));

When $search_ret['match'] (the result of an $imap->search() call) 
contains no matches. Not sure if this needs to be handled in the imap 
code or not, but with this commit the call should no longer be made 
with the empty result set.
08/08/2013 07:15:21 PM Git Commit Comment #5 Reply to this comment
Changes have been made in Git (master):

commit 31e1aab7e8bd68f7a6009ebe1e3e69e9f06af060
Author: Michael J Rubinsky <mrubinsk@horde.org>
Date:   Thu Aug 8 15:14:33 2013 -0400

     Don't attempt to fetch flags if we don't have any message ids.

     Bug: 12551

  .../lib/Horde/ActiveSync/Imap/Adapter.php          |   24 ++++++++++---------
  1 files changed, 13 insertions(+), 11 deletions(-)

http://git.horde.org/horde-git/-/commit/31e1aab7e8bd68f7a6009ebe1e3e69e9f06af060
08/08/2013 07:01:24 PM Michael Slusarz Comment #4
State ⇒ Assigned
Assigned to Michael Slusarz
Assigned to Michael Rubinsky
Reply to this comment
Probably best for Mike R. to look at activesync logs first, and he can 
let me know what is being passed to the Imap library.
08/08/2013 03:54:47 PM Thomas Jarosch Comment #3 Reply to this comment
I've changed one debug logger to dump $res
as it might give more information:

------------------------
2013-08-08T17:52:38+02:00 ERR: HORDE [horde] $res: Array
(
     [count] => 0
     [match] => Horde_Imap_Client_Ids Object
         (
             [duplicates] =>
             [_ids:protected] => Array
                 (
                 )

             [_sequence:protected] =>
             [_sorted:protected] =>
         )

)
------------------------

08/08/2013 03:45:13 PM Thomas Jarosch Comment #2
New Attachment: 356938030416912.txt Download
Reply to this comment
ActiveSync log from one sync run that triggers the PHP error message.

08/08/2013 03:44:15 PM Thomas Jarosch Comment #1
State ⇒ Unconfirmed
Patch ⇒ No
Milestone ⇒
Queue ⇒ Horde Framework Packages
Summary ⇒ Horde_Imap_Client: array_combine() error message
Type ⇒ Bug
Priority ⇒ 1. Low
Reply to this comment
Hi,

while playing with ActiveSync and a Nokia N900, I noticed this error 
message in the logs:

2013-08-08T17:11:51+02:00 WARN: HORDE [horde] PHP ERROR: 
array_combine() [<a 
href='function.array-combine'>function.array-combine</a>]: Both 
parameters should have an equal number of elements [pid 8511 on line 
3603 of "/datastore/share/pear/Horde/Imap/Client/Base.php"]


The array_combine() call is inside Horde_Imap_Client_Base::resolveIds().

I've added this debug logging code:
-----------------------------------------
@@ -3601,6 +3601,11 @@
              }

              $map->update(array_combine($ids->ids, $res['match']->ids));
+            Horde::log(sprintf('Mailbox: %s', print_r($mailbox, 
true)), 'ERR');
+            Horde::log(sprintf('$ids->ids: %s', print_r($ids->ids, 
true)), 'ERR');
+            Horde::log(sprintf('$res[match]->ids: %s', 
print_r($res['match']->ids, true)), 'ERR');
+            $e = new Exception();
+            Horde::log('Call trace: '.$e->getTraceAsString(), 'ERR');
          }

          return $res['match'];
-----------------------------------------

The corresponding output:

-----------------------------------------
2013-08-08T17:35:24+02:00 WARN: HORDE [horde] PHP ERROR: 
array_combine() [<a 
href='function.array-combine'>function.array-combine</a>]: Both 
parameters should have an equal number of elements [pid 8511 on line 
3603 of "/datastore/share/pear/Horde/Imap/Client/Base.php"]
2013-08-08T17:35:24+02:00 ERR: HORDE [horde] Mailbox: 
Horde_Imap_Client_Mailbox Object
(
     [_utf7imap:protected] => 1
     [_utf8:protected] => INBOX
)
  [pid 8511 on line 3604 of "/datastore/share/pear/Horde/Imap/Client/Base.php"]
2013-08-08T17:35:24+02:00 ERR: HORDE [horde] $ids->ids: Array
(
     [0] => 0
     [1] => 1
)
  [pid 8511 on line 3605 of "/datastore/share/pear/Horde/Imap/Client/Base.php"]
2013-08-08T17:35:24+02:00 ERR: HORDE [horde] $res[match]->ids: Array
(
)
  [pid 8511 on line 3606 of "/datastore/share/pear/Horde/Imap/Client/Base.php"]
2013-08-08T17:35:24+02:00 ERR: HORDE [horde] Call trace: #0 
/datastore/share/pear/Horde/Imap/Client/Base.php(2683): 
Horde_Imap_Client_Base->resolveIds(Object(Horde_Imap_Client_Mailbox), 
Object(Horde_Imap_Client_Ids), 1)
#1 /datastore/share/pear/Horde/Imap/Client/Base.php(2568): 
Horde_Imap_Client_Base->_fetchWrapper(Object(Horde_Imap_Client_Mailbox), 
Object(Horde_Imap_Client_Fetch_Query), Array)
#2 /datastore/share/pear/Horde/ActiveSync/Imap/Adapter.php(396): 
Horde_Imap_Client_Base->fetch(Object(Horde_Imap_Client_Mailbox), 
Object(Horde_Imap_Client_Fetch_Query), Array)
#3 /datastore/share/pear/Horde/Core/ActiveSync/Driver.php(674): 
Horde_ActiveSync_Imap_Adapter->getMessageChanges(Object(Horde_ActiveSync_Folder_Imap), 
Array)
#4 /datastore/share/pear/Horde/ActiveSync/State/Sql.php(892): 
Horde_Core_ActiveSync_Driver->getServerChanges(Object(Horde_ActiveSync_Folder_Imap), 1375972572, 1375976124, 1375716924, false, 
true)
#5 /datastore/share/pear/Horde/ActiveSync/Collections.php(1174): 
Horde_ActiveSync_State_Sql->getChanges(Array)
#6 /datastore/share/pear/Horde/ActiveSync/Collections.php(1183): 
Horde_ActiveSync_Collections->getCollectionChanges(false)
#7 /datastore/share/pear/Horde/ActiveSync/Request/Sync.php(386): 
Horde_ActiveSync_Collections->getCollectionChangeCount()
#8 /datastore/share/pear/Horde/ActiveSync/Request/Base.php(252): 
Horde_ActiveSync_Request_Sync->_handle()
#9 /datastore/share/pear/Horde/ActiveSync.php(861): 
Horde_ActiveSync_Request_Base->handle()
#10 /datastore/share/pear/Horde/Rpc/ActiveSync.php(141): 
Horde_ActiveSync->handleRequest('Sync', '356938030416912')
#11 /datastore/share/pear/www/horde/rpc.php(156): 
Horde_Rpc_ActiveSync->getResponse(NULL)
#12 {main} [pid 8511 on line 3608 of 
"/datastore/share/pear/Horde/Imap/Client/Base.php"]
-----------------------------------------

Cheers,
Thomas

Saved Queries