6.0.0-git
2019-03-24

[#9213] Left pane menu crash when no folder on imap server
Summary Left pane menu crash when no folder on imap server
Queue IMP
Queue Version 4.3.8
Type Bug
State Resolved
Priority 1. Low
Owners slusarz (at) horde (dot) org
Requester luc.germain (at) usherbrooke (dot) ca
Created 2010-09-01 (3126 days ago)
Due
Updated 2010-10-21 (3076 days ago)
Assigned 2010-10-01 (3096 days ago)
Resolved 2010-10-21 (3076 days ago)
Milestone
Patch No

History
2010-10-21 06:10:13 Michael Slusarz State ⇒ Resolved
 
2010-10-01 07:14:39 Michael Slusarz Comment #8
State ⇒ Feedback
Version ⇒ 4.3.8
Reply to this comment
How about this?  I still can't reproduce an infinite loop, but I was 
able to reproduce a bunch of error messages (but only if all virtual 
folders were turned off).
2010-10-01 07:13:03 CVS Commit Comment #7 Reply to this comment
Changes have been made in CVS for this ticket:

Bug: 9213
Make there is always namespace info for INBOX.
http://cvs.horde.org/diff.php/imp/lib/IMP.php?rt=horder1=1.449.4.129r2=1.449.4.130ty=u
2010-09-30 18:22:16 luc (dot) germain (at) usherbrooke (dot) ca Comment #6 Reply to this comment
Try this.
It did not solve the problem. Although the Inbox is now in the folder 
tree, the first element of the namespaces array (for the type 
"personal") is still missing, and this is what seems to be causing the 
infinite loop.


2010-09-22 06:35:20 Michael Slusarz State ⇒ Resolved
 
2010-09-11 16:59:29 Michael Slusarz Comment #5
Assigned to Michael Slusarz
Reply to this comment
Try this.
2010-09-11 16:59:14 CVS Commit Comment #4 Reply to this comment
Changes have been made in CVS for this ticket:

Bug: 9213
It is possible that the INBOX value may be removed if the server does not
return INBOX in its folder listing.
http://cvs.horde.org/diff.php/imp/lib/IMAP/Tree.php?rt=horder1=1.25.2.71r2=1.25.2.72ty=u
2010-09-09 18:52:18 luc (dot) germain (at) usherbrooke (dot) ca Comment #3 Reply to this comment
I can't reproduce this.
Here are "print_r" of some arrays that might help you. These are 
obtained when I have no folders (other than INBOX).

- print_r of the result of "$this->_runCommand('NAMESPACE');" from 
imp/lib/IMAP/Client.php

IMAP_CLIENT readNamespaces: stdClass Object
(
     [response] => OK
     [message] => NAMESPACE NIL NIL (("Shared/" "/"))
     [type] => 1
)

- print_r of "$this->_namespaces" in function init() from 
imp/lib/IMAP/Tree.php

(
     [Shared/] => Array
         (
             [name] => Shared/
             [delimiter] => /
             [type] => shared
             [hidden] =>
         )
)

=> note that there is no "[type] => personal" section in the array

- print_r of "$this->_tree" just before leaving init() in 
imp/lib/IMAP/Tree.php

(
     [%] => Array
         (
             [a] => 64
             [v] => %
         )
)

=> note: there is no [INBOX] element...

- print_r of $tree_ob just before   foreach($tree_ob[0], ...

(
     [0] => Array
         (
             [0] => Array
                 (
                     [display] =>
                     [peek] =>
                 )

         )

     [1] => Array
         (
         )

     [2] => Array
         (
             [0] =>
         )

)

=> no [value]...


Hope this help.
2010-09-07 21:19:52 Michael Slusarz Comment #2
State ⇒ Feedback
Priority ⇒ 1. Low
Reply to this comment
I can't reproduce this.  And can't figure out how you would see this, 
because this would require inserting a mailbox with a blank value.   
See imp/lib/Block/tree_folders.php:86:
$tree->addNode($parent . $val['value'], ...);

$parent should be 'imp' here, $val['value'] is the mailbox name being added.

What entry for you has an empty $val['value'] value?
2010-09-01 19:22:54 luc (dot) germain (at) usherbrooke (dot) ca Comment #1
Type ⇒ Bug
State ⇒ Unconfirmed
Priority ⇒ 2. Medium
Summary ⇒ Left pane menu crash when no folder on imap server
Queue ⇒ IMP
Milestone ⇒
Patch ⇒ No
Reply to this comment
When a user has no folder in his account on our IMAP server (cyrus 
2.2), the menu in the left frame does not show up; in fact, the 
request in this frame is crashing.

Digging down the code, I found out the cause is how IMP treat the 
answer to the NAMESPACE imap command. When the user has at least on 
folder, the NAMESPACE command return the following:

NAMESPACE (("" "/")) NIL (("[Shared]/" "/"))

But when there is no folder (other than INBOX), the NAMESPACE command return:

NAMESPACE NIL NIL (("[Shared]/" "/"))

The way this is treated in IMP cause an entry "imp" to be inserted as 
a child in the "imp" section of the menu tree, and later cause an 
infinite loop when walking the menu tree, and PHP crash due to memory 
exhaustion.

I temporarily patched the horde/imp/lib/IMAP/Client.php file at line 
603 to replace
'NAMESPACE NIL '
by
'NAMESPACE (("" "/")) '
when found in the result of the NAMESPACE command, but IMP should be 
able to manage the returned value

NAMESPACE NIL NIL (("[Shared]/" "/"))

correctly (as it IS a valid answer!)

I tried to make a better fix, but the code that builds the menu tree 
is a bit too complex for me...

Saved Queries