[#7596] Searching for unseen messages doesn't work: Undefined index: unseen
Summary Searching for unseen messages doesn't work: Undefined index: unseen
Queue IMP
Queue Version 4.3
Type Bug
State Not A Bug
Priority 1. Low
Owners
Requester amg1127 (at) cefetrs (dot) tche (dot) br
Created 10/28/2008 (249 days ago)
Due
Updated 04/30/2009 (65 days ago)
Assigned 11/05/2008 (241 days ago)
Resolved 12/03/2008 (213 days ago)
Attachments horde-config.tar.bz2 Download
Milestone
Patch No

History
04/30/2009 amg1127 (at) cefetrs (dot) tche (dot) br Comment #7 Reply to this comment
Humm... The bug was fixed in revision 2.128.2.33...

http://cvs.horde.org/co.php/imp/search.php?r=2.128.2.33

I don't see the bug in IMP 4.3.4.
12/03/2008 amg1127 (at) cefetrs (dot) tche (dot) br Comment #6 Reply to this comment
And please, reopen this bug, because it's still present in my system!
12/03/2008 amg1127 (at) cefetrs (dot) tche (dot) br Comment #5
New Attachment: horde-config.tar.bz2 Download
Reply to this comment
Can't reproduce.  And we already cast any data passed in to an 
integer.  See line 938 of imp/lib/Search.php:
$ob->size(intval($search['text'][$key]), ($val == 'size_larger') ? 
'>' : '<');
Ok, ok... The problem in the size field is not important here...
My headache occurs because I still can't look for unseen messages 
without enabling compression in Horde.

Please, try to reproduce the searching bug using my configuration 
(attached). You will need a MySQL server and a GMail account with IMAP 
enabled.
12/03/2008 Michael Slusarz Comment #4
State ⇒ Not A Bug
Reply to this comment
Can't reproduce.  And we already cast any data passed in to an 
integer.  See line 938 of imp/lib/Search.php:
$ob->size(intval($search['text'][$key]), ($val == 'size_larger') ? '>' : '<');
11/08/2008 amg1127 (at) cefetrs (dot) tche (dot) br Comment #3 Reply to this comment
I can't reproduce this with 4.3-CVS, and no changes have been made 
to that code since 4.3.0.
Sorry for my delay... I was trying to find a way to reproduce the bug 
in a new Horde+IMP installation.

In order to reproduce the bug, I think it's enough adding these lines 
at end of horde/config/conf.php:
$conf['compress_pages'] = false;
$conf['debug_level'] = E_ALL;

--------------

I investigated the source code... In imp/search.php, line 73, it tries 
to find integer search fields, in order to convert sizes from 
kilobytes to bytes. When an user specifies he wants to find unseen 
messages, the browser generates a field with value "unseen" in 
$search['field'][$i]. $imp_search_fields receives an array from 
$imp_search->searchFields(), that is defined in imp/lib/Search.php at 
line 702. The problem occurs because the returned array doesn't define 
the index 'unseen'.

I wish to do some suggestions:
# Track PHP errors with set_error_handler() 
(http://br.php.net/manual/en/function.set-error-handler.php), so Horde 
can optionally log errors in logfile or display PHP errors, even if 
there is an output handler capturing output.
# In imp/search.php, line 74, IMP shouldn't assume user input is a 
valid integer. By example, IMP should throw an error if an user tries 
to search messages with "size >= k1024abc"...
11/05/2008 Chuck Hagenbuch Comment #2
State ⇒ Feedback
Reply to this comment
I can't reproduce this with 4.3-CVS, and no changes have been made to 
that code since 4.3.0.
10/28/2008 amg1127 (at) cefetrs (dot) tche (dot) br Comment #1
Patch ⇒
Milestone ⇒
Summary ⇒ Searching for unseen messages doesn't work: Undefined index: unseen
Type ⇒ Bug
Priority ⇒ 1. Low
State ⇒ Unconfirmed
Queue ⇒ IMP
Reply to this comment
When I try to search unseen messages in my IMAP folders, this is all I get:

Notice: Undefined index: unseen in /var/www/horde33/imp/search.php on line 73

Warning: Cannot modify header information - headers already sent by 
(output started at /var/www/horde33/imp/search.php:73) in 
/var/www/horde33/imp/search.php on line 96