Summary | IMP_Tree::insert() burfs when it sees a parent with nothing in it |
Queue | IMP |
Queue Version | HEAD |
Type | Bug |
State | Resolved |
Priority | 2. Medium |
Owners | |
Requester | ntai (at) smartfruit (dot) com |
Created | 02/08/2007 (6726 days ago) |
Due | |
Updated | 02/10/2007 (6724 days ago) |
Assigned | 02/09/2007 (6725 days ago) |
Resolved | 02/10/2007 (6724 days ago) |
Github Issue Link | |
Github Pull Request | |
Milestone | |
Patch | No |
State ⇒ Resolved
New Attachment: foo.txt
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.
print_r($newboxes) right after that call return?
Priority ⇒ 2. Medium
Type ⇒ Bug
Summary ⇒ IMP_Tree::insert() burfs when it sees a parent with nothing in it
Queue ⇒ IMP
State ⇒ Unconfirmed
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);