[turba] LDAP Write then Read On-screen Object-not-found Error When Adding Address

Andy Dorman AndyDorman at comehome.net
Wed Feb 11 16:11:46 UTC 2015


Our Horde setup uses OpenLDAP for authentication and personal address books.

Our OpenLDAP setup is a master LDAP server replicating to local LDAP  
running on each webmail machine.  All the local LDAP processes are  
configured to redirect writes to the master which are then replicated  
back, usually in less than a second.

I have run into a problem when adding an address book entry.  After  
submitting a new entry we get a Horde "object not found" error up on  
the screen.  If we navigate back to the address book we can see the  
new entry has been added.

I assumed this probably meant Turba was checking for the new address  
before it has been replicated back to the local LDAP.

However, I found a clever bit of work in  
/usr/share/horde/turba/lib/Form/AddContact.php that is obviously  
intended to avoid problems with replication delay most of the  
time...except it doesn't actually appear to work as intended.

The code block looks like this:

// Try 3 times to get the new entry. We retry to allow setups like
// LDAP replication to work.
for ($i = 0; $i < 3; ++$i) {
     try {
         $ob = $driver->getObject($key);
         $notification->push(sprintf(_("%s added."),  
$ob->getValue('name')), 'horde.success');
         $url = empty($info['url'])
             ? $ob->url('Contact', true)
             : new Horde_Url($info['url']);
         $url->redirect();
     } catch (Horde_Exception_NotFound $e) {
     }
     sleep(1);
}

I am not an experienced PHP programmer (my background is mostly perl),  
but it looked to me like the first time through the loop the getObject  
call was failing (as expected while replication was catching up) and  
the catch call to Horde_Exception_NotFound was triggering the  
on-screen error report.

As an experiment I replaced "Horde_Exception_NotFound" with  
"Exception" and the on-screen error report is gone and the new  
addresses are successfully added.

So is there possibly a way to call Horde_Exception_NotFound in the  
catch argument above and NOT have it post the on-screen error?

If someone can confirm this is actually a bug and not something I have  
mis-configured, I will post a bug report.

Thanks.

-- 
Andy Dorman

-- 
Andy--------------------------------
This message was sent using FanMailPlus Webmail.



More information about the turba mailing list