Summary | PHP ERROR: array_intersect_key() when purging deleted items |
Queue | IMP |
Queue Version | 6.1.5 |
Type | Bug |
State | Resolved |
Priority | 1. Low |
Owners | slusarz (at) horde (dot) org |
Requester | aria (at) bsc (dot) gwu (dot) edu |
Created | 11/08/2013 (4265 days ago) |
Due | |
Updated | 11/21/2013 (4252 days ago) |
Assigned | 11/11/2013 (4262 days ago) |
Resolved | 11/21/2013 (4252 days ago) |
Github Issue Link | |
Github Pull Request | |
Milestone | |
Patch | No |
State ⇒ Resolved
commit fb255f0aa4ed4a12a1c9d8df996bdc26a0f536c3
Author: Michael M Slusarz <slusarz@horde.org>
Date: Thu Nov 21 14:32:03 2013 -0700
[mms] Fix intermittent error when purging messages using a
Horde_Cache caching backend (
Bug #12827).framework/Imap_Client/package.xml | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
http://git.horde.org/horde-git/-/commit/fb255f0aa4ed4a12a1c9d8df996bdc26a0f536c3
I don't have access to your GIT so I will wait until this one makes it
out on a release. THANKS for fixing.
Assigned to Michael Slusarz
And TIL that assigning a reference to a non-existent array key DOESN'T
cause a PHP error - it instead creates a reference to a null value.
(Although it is documented, so my bad:
http://www.php.net/manual/en/language.references.whatdo.php)
commit dbf3b9f6529b4b17e62fb999b18c268ea2c24480
Author: Michael M Slusarz <slusarz@horde.org>
Date: Wed Nov 20 21:52:23 2013 -0700
Fix error message when deleting messages using a Horde_Cache
caching backend
Bug #12827.../lib/Horde/Imap/Client/Cache/Backend/Cache.php | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
http://git.horde.org/horde-git/-/commit/dbf3b9f6529b4b17e62fb999b18c268ea2c24480
New Attachment: debug-purge.txt
#2New Attachment: debug-login.txt
wanted but I have no understanding of PHP and am not a software
developer.
Here is a summary of what I did.
0-setup the PEAR/Horde/Imap/Client/Cache/Backend/Cache.php file with
the debug statements (see below).
1-Cleared the cache backend (file system)
2-sent two messages to a test user with an empty inbox
3-login as the test user and display the inbox resulting in a debug
file being generated. See attachment debug-login.txt
4-marked messages for deletion and click purge deleted. See
attachment debug-purge.txt
To setup the debug, I changed two functions in the Cache.php file as follows:
public function deleteMsgs($mailbox, $uids)
{
$dmsg = "deleteMsgs-ENTRY";
Horde::debug($dmsg);
Horde::debug($this->_slicemap);
$slicemap = &$this->_slicemap[$mailbox];
$dmsg = "deleteMsgs-POINT-1";
Horde::debug($dmsg);
Horde::debug($this->_slicemap);
$deleted = array_intersect_key($slicemap['s'], array_flip($uids));
(snip)
And further down:
protected function _loadSliceMap($mailbox, $uidvalid = null)
{
$dmsg = "_loadSliceMap-TOP";
Horde::debug($dmsg);
Horde::debug($this->_slicemap);
if (!isset($this->_slicemap[$mailbox]) &&
(($data = $this->_cache->get($this->_getCid($mailbox,
'slicemap'), 0)) !== false) &&
($slice = @unserialize($data)) &&
is_array($slice)) {
$this->_slicemap[$mailbox] = $slice;
}
$dmsg = "_loadSliceMap-AFTER-IF-1";
Horde::debug($dmsg);
Horde::debug($this->_slicemap);
if (isset($this->_slicemap[$mailbox])) {
$ptr = &$this->_slicemap[$mailbox];
if (is_null($ptr['d']['uidvalid'])) {
$ptr['d']['uidvalid'] = $uidvalid;
$dmsg = "_loadSliceMap-RETURN-1";
Horde::debug($dmsg);
Horde::debug($this->_slicemap);
return;
} elseif (!is_null($uidvalid) &&
($ptr['d']['uidvalid'] != $uidvalid)) {
$this->_deleteMailbox($mailbox);
} else {
$dmsg = "_loadSliceMap-RETURN-2";
Horde::debug($dmsg);
Horde::debug($this->_slicemap);
return;
}
}
$dmsg = "_loadSliceMap-AFTER-IF-2";
Horde::debug($dmsg);
Horde::debug($this->_slicemap);
$this->_slicemap[$mailbox] = array(
// Tracking count for purposes of determining slices
'c' => 0,
// Metadata storage
// By default includes UIDVALIDITY of mailbox.
'd' => array('uidvalid' => $uidvalid),
// The ID of the last slice.
'i' => 0,
// The slice list.
's' => array()
);
$dmsg = "_loadSliceMap-END";
Horde::debug($dmsg);
Horde::debug($this->_slicemap);
}
It appears that when you click purge deleted, the function
loadslicemap is not called at all.
Something tells me this is not going to be useful. If not, please let
me know what to change or send me a php code that has the debug
statements you need and I will use that.
Thanks,
Aria
where it would be most helpful. I also am testing this on a
separate system so I can do any type of debugging you need.
all throughout the code to figure out when the _slicemap variable is
altered. (the 'INBOX' key should contain an array value, rather than
a null value).
I would start in _loadSliceMap(), since that's where $_slicemap is
rebuilt from cache data.
Ubuntu/Debian versions?
And I don't believe any of the Horde_Cache drivers do either.
Ubuntu/Debian versions?
php53-json-5.3.17-0.15.1.
where it would be most helpful. I also am testing this on a separate
system so I can do any type of debugging you need.
Ubuntu/Debian versions?
array(1) {
["INBOX"]=>
&NULL
}
The _slicemap variable, at the mailbox level, can only be altered in
these locations:
save() - no way this can be set to null.
clear() - this would destroy the INBOX key, so that's not it
_deleteMailbox - see (clear) - would destroy the INBOX key entirely.
That leaves _loadSliceMap(). But this can't be it either. _slicemap
is only set from cache data IF the unserialized data is an array.
Otherwise, the slicemap is recreated as an array value.
I am totally out of ideas. Someone is going to have to track this
down locally. I can neither reproduce, and there is no place in the
code where this can happen that I can see.
2013-11-18T23:04:01+00:00 DEBUG: Variable information:
array(1) {
["INBOX"]=>
&NULL
}
Backtrace:
1. Horde_Core_Ajax_Application->doAction()
/data/www/horde/services/ajax.php:58
2. call_user_func() /usr/share/php5/PEAR/Horde/Core/Ajax/Application.php:162
3. IMP_Ajax_Application_Handler_Dynamic->purgeDeleted()
4. IMP_Message->expungeMailbox()
/data/www/horde/imp/lib/Ajax/Application/Handler/Dynamic.php:737
5. IMP_Imap->expunge() /data/www/horde/imp/lib/Message.php:803
6. IMP_Imap->__call() /data/www/horde/imp/lib/Message.php:803
7. call_user_func_array() /data/www/horde/imp/lib/Imap.php:566
8. Horde_Imap_Client_Base->expunge()
9. Horde_Imap_Client_Socket->_expunge()
/usr/share/php5/PEAR/Horde/Imap/Client/Base.php:2106
10. Horde_Imap_Client_Socket->_sendCmd()
/usr/share/php5/PEAR/Horde/Imap/Client/Socket.php:1958
11. Horde_Imap_Client_Socket->_sendCmdChunk()
/usr/share/php5/PEAR/Horde/Imap/Client/Socket.php:3863
12. Horde_Imap_Client_Socket->_getLine()
/usr/share/php5/PEAR/Horde/Imap/Client/Socket.php:3933
13. Horde_Imap_Client_Socket->_serverResponse()
/usr/share/php5/PEAR/Horde/Imap/Client/Socket.php:4145
14. Horde_Imap_Client_Socket->_deleteMsgs()
/usr/share/php5/PEAR/Horde/Imap/Client/Socket.php:4334
15. Horde_Imap_Client_Base->_deleteMsgs()
/usr/share/php5/PEAR/Horde/Imap/Client/Socket.php:3810
16. Horde_Imap_Client_Cache->deleteMsgs()
/usr/share/php5/PEAR/Horde/Imap/Client/Base.php:3940
17. Horde_Imap_Client_Cache_Backend_Cache->deleteMsgs()
/usr/share/php5/PEAR/Horde/Imap/Client/Cache.php:218
18. Horde::debug()
/usr/share/php5/PEAR/Horde/Imap/Client/Cache/Backend/Cache.php:278
modules to help gather some information that would be useful? If
so, please let me know what module and what to add and I will gladly
send you the results.
if (!is_array($slicemap['s'])) {
Horde::debug($this->_slicemap);
}
Horde::debug() documentation: http://wiki.horde.org/Doc/Dev/DebugH4
more messages than fit into a single slice. I still can't reproduce
this error.
modules to help gather some information that would be useful? If so,
please let me know what module and what to add and I will gladly send
you the results.
more messages than fit into a single slice. I still can't reproduce
this error.
State ⇒ Feedback
"So what is argument
#1to array_intersect_keys()?""There is no way I can see that slicemap['s'] can be anything but an
array. "
[imp] PHP ERROR: array_intersect_key(): Argument
#1is not an array[pid 83445 on line 276 of
"/usr/local/share/pear/Horde/Imap/Client/Cache/Backend/Cache.php"]
server side cache as well. I have seen this message in the latest GA
release for Horde/IMP and in previous releases over the past few months.
Priority ⇒ 1. Low
State ⇒ Unconfirmed
Patch ⇒ No
Milestone ⇒
Summary ⇒ PHP ERROR: array_intersect_key() when purging deleted items
Type ⇒ Bug
Queue ⇒ IMP
When I click purge deleted in a mailbox using any of the IMP
interfaces, I get the following error message in the horde.log file:
WARN: HORDE [imp] PHP ERROR: array_intersect_key(): Argument
#1is notan array [pid 7485 on line 276 of
"/usr/share/php5/PEAR/Horde/Imap/Client/Cache/Backend/Cache.php"]
I do NOT get the message if I just delete a message. I do not use a
trash mailbox. Deleted messages remain in the mailbox and are just
marked as deleted until purged.
This is similar to the dev discussion here:
http://lists.horde.org/archives/dev/Week-of-Mon-20090413/023933.html
and a closed ticket here: http://bugs.horde.org/ticket/12593
Please let me know how I can provide additional information to assist.
Thanks,
Aria