<?xml version="1.0" encoding="UTF-8"?> 
<?xml-stylesheet href="https://dev.horde.org/themes/horde//default/feed-rss.xsl" type="text/xsl"?> 
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"> 
 <channel> 
  <title>IMP_Tree::insert() burfs when it sees a parent with nothing in it</title> 
  <pubDate>Fri, 10 Apr 2026 09:21:05 +0000</pubDate> 
  <link>https://bugs.horde.org/ticket/4987</link> 
  <atom:link rel="self" type="application/rss+xml" title="IMP_Tree::insert() burfs when it sees a parent with nothing in it" href="https://bugs.horde.org/ticket/4987/rss" /> 
  <description>IMP_Tree::insert() burfs when it sees a parent with nothing in it</description> 
 
   
   
  <item> 
   <title>It burfed on me when IMP_Tree was retriveing a tree from IMA</title> 
   <description>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-&gt;_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&#039;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-&gt;_removeServerString($box);

                      if ($box-&gt;name &amp;&amp; !isset($unique[$box-&gt;name])) {

!                         $unique[$box-&gt;name] = $box;

                      }

                  }

              }

--- 337,345 ----

                      /* Strip off server string. */

                      $box = $this-&gt;_removeServerString($box);

                      if ($box-&gt;name &amp;&amp; !isset($unique[$box-&gt;name])) {

! 			if ( ($box-&gt;name . &#039;/%&#039;) != $path) {

!                             $unique[$box-&gt;name] = $box;

! 			}

                      }

                  }

              }

***************

*** 830,845 ****

                  }

              } else {

                  $ob = $this-&gt;_getList($id);

!                 $elt = $this-&gt;_makeMailboxTreeElt(reset($ob));

!                 if (!$this-&gt;isSubscribed($elt)) {

!                     $tmp = @imap_lsub($imp_imap-&gt;stream(), $this-&gt;_server, $elt[&#039;v&#039;]);

!                     if (!empty($tmp)) {

!                         $this-&gt;_setSubscribed($elt, true);

                      }

                  }

              }

  

!             if ($this-&gt;_insertElt($elt)) {

                  /* We know that the parent folder has children. */

                  if (isset($this-&gt;_tree[$elt[&#039;p&#039;]])) {

                      $this-&gt;_setChildren($this-&gt;_tree[$elt[&#039;p&#039;]], true);

--- 832,852 ----

                  }

              } else {

                  $ob = $this-&gt;_getList($id);

!                 if ($ob) {

!                     $elt = $this-&gt;_makeMailboxTreeElt(reset($ob));

!                     if (!$this-&gt;isSubscribed($elt)) {

!                         $tmp = @imap_lsub($imp_imap-&gt;stream(), $this-&gt;_server, $elt[&#039;v&#039;]);

!                         if (!empty($tmp)) {

!                             $this-&gt;_setSubscribed($elt, true);

!                         }

                      }

                  }

+                 else {

+                     $elt = null;

+                 }

              }

  

!             if ($elt &amp;&amp; $this-&gt;_insertElt($elt)) {

                  /* We know that the parent folder has children. */

                  if (isset($this-&gt;_tree[$elt[&#039;p&#039;]])) {

                      $this-&gt;_setChildren($this-&gt;_tree[$elt[&#039;p&#039;]], true);

</description> 
   <pubDate>Thu, 08 Feb 2007 23:07:25 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/4987#t29326</link> 
  </item> 
   
  <item> 
   <title>&gt; It burfed on me when IMP_Tree was retriveing a tree from I</title> 
   <description>&gt; It burfed on me when IMP_Tree was retriveing a tree from IMAP account 

&gt; which consists of a folder with nothing?.

&gt;

&gt; Here is what I had to do to make this work.

&gt;

&gt; $ob = $this-&gt;_getList($id); somehow managed to return null. This may 

&gt; or may not be the problem of IMAP driver, which I do not know.



What is imap_getmailboxes() returning in _getList()?  i.e. what does a print_r($newboxes) right after that call return?</description> 
   <pubDate>Fri, 09 Feb 2007 06:09:36 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/4987#t29336</link> 
  </item> 
   
  <item> 
   <title>print_f($newboxes) is in attachement

</title> 
   <description>print_f($newboxes) is in attachement

</description> 
   <pubDate>Fri, 09 Feb 2007 18:01:59 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/4987#t29360</link> 
  </item> 
   
  <item> 
   <title>Added a sanity check to skip adding an element if getList() </title> 
   <description>Added a sanity check to skip adding an element if getList() returns empty.</description> 
   <pubDate>Sat, 10 Feb 2007 22:49:52 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/4987#t29383</link> 
  </item> 
   
   
 
 </channel> 
</rss> 
