[Tickets #4987] IMP_Tree::insert() burfs when it sees a parent with nothing in it

bugs@bugs.horde.org bugs at bugs.horde.org
Thu Feb 8 15:07:26 PST 2007


DO NOT REPLY TO THIS MESSAGE. THIS EMAIL ADDRESS IS NOT MONITORED.

Ticket URL: http://bugs.horde.org/ticket/?id=4987
-----------------------------------------------------------------------
 Ticket             | 4987
 Created By         | ntai at smartfruit.com
 Summary            | IMP_Tree::insert() burfs when it sees a parent with nothing in it
 Queue              | IMP
 Version            | HEAD
 Type               | Bug
 State              | Unconfirmed
 Priority           | 2. Medium
 Owners             | 
-----------------------------------------------------------------------


ntai at smartfruit.com (2007-02-08 15:07) wrote:

It burfed on me when IMP_Tree was retriveing a tree from IMAP account which
consists of a folder with nothing?.

Here is what I had to do to make this work.

$ob = $this->_getList($id); somehow managed to return null. This may or
may not be the problem of IMAP driver, which I do not know.

Since $ob is nothing, I changed the function to not burf seeing null $ob.
I don't have enough klowledge to do the real fix but the change works for
me.



Index: Tree.php
===================================================================
RCS file: /repository/imp/lib/IMAP/Tree.php,v
retrieving revision 1.144
diff -c -r1.144 Tree.php
*** Tree.php	4 Feb 2007 05:13:11 -0000	1.144
--- Tree.php	8 Feb 2007 23:02:42 -0000
***************
*** 337,343 ****
                      /* Strip off server string. */
                      $box = $this->_removeServerString($box);
                      if ($box->name && !isset($unique[$box->name])) {
!                         $unique[$box->name] = $box;
                      }
                  }
              }
--- 337,345 ----
                      /* Strip off server string. */
                      $box = $this->_removeServerString($box);
                      if ($box->name && !isset($unique[$box->name])) {
! 			if ( ($box->name . '/%') != $path) {
!                             $unique[$box->name] = $box;
! 			}
                      }
                  }
              }
***************
*** 830,845 ****
                  }
              } else {
                  $ob = $this->_getList($id);
!                 $elt = $this->_makeMailboxTreeElt(reset($ob));
!                 if (!$this->isSubscribed($elt)) {
!                     $tmp = @imap_lsub($imp_imap->stream(),
$this->_server, $elt['v']);
!                     if (!empty($tmp)) {
!                         $this->_setSubscribed($elt, true);
                      }
                  }
              }
  
!             if ($this->_insertElt($elt)) {
                  /* We know that the parent folder has children. */
                  if (isset($this->_tree[$elt['p']])) {
                      $this->_setChildren($this->_tree[$elt['p']], true);
--- 832,852 ----
                  }
              } else {
                  $ob = $this->_getList($id);
!                 if ($ob) {
!                     $elt = $this->_makeMailboxTreeElt(reset($ob));
!                     if (!$this->isSubscribed($elt)) {
!                         $tmp = @imap_lsub($imp_imap->stream(),
$this->_server, $elt['v']);
!                         if (!empty($tmp)) {
!                             $this->_setSubscribed($elt, true);
!                         }
                      }
                  }
+                 else {
+                     $elt = null;
+                 }
              }
  
!             if ($elt && $this->_insertElt($elt)) {
                  /* We know that the parent folder has children. */
                  if (isset($this->_tree[$elt['p']])) {
                      $this->_setChildren($this->_tree[$elt['p']], true);





More information about the bugs mailing list