Net_LDAP & Exceptions
| From: | Jeff Loiselle | Date: | Mon, 12 Sep 2005 23:31:10 +0000 |
| Subject: | Net_LDAP & Exceptions | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-20929@lists.php.net to get a copy of this message | ||
Does Net_LDAP work for PHP4 as well as PHP5? I can't find this information anywhere within the package or on the PEAR site. When I purposely send bad credentials and check for error, I can't seem to trap it as it is throwing Exceptions. Is this really an Exception? Is there a way to trap these errors?
// BIND TO LDAP SERVER
$ldap = Net_LDAP::connect($config);
if (Net_LDAP::isError($ldap)) {
print 'error';
exit;
}
---
Warning: PEAR_ERROR_EXCEPTION is obsolete, use class PEAR_ErrorStack for exceptions in /usr/share/pear/PEAR.php on line 862
Fatal error: Uncaught exception 'Exception' with message 'Net_LDAP_Error: Bind failed Invalid credentials' in /usr/share/pear/PEAR.php(863) : eval()'d code:1 Stack trace: #0 /usr/share/pear/PEAR.php(863) : eval()'d code(1): unknown() #1 /usr/share/pear/PEAR.php(863): eval() #2 /usr/share/pear/Net/LDAP.php(1060): Net_LDAP_Error->PEAR_Error('Net_LDAP_Error:...', 1000, 49, 1, 1024) #3 /usr/share/pear/PEAR.php(542): Net_LDAP_Error->Net_LDAP_Error('Bind failed Inv...', 49, 1, 1024, NULL) #4 /usr/share/pear/Net/LDAP.php(209): Net_LDAP->raiseError('Bind failed Inv...', 49) #5 /usr/share/pear/Net/LDAP.php(146): Net_LDAP->bind() #6 /home/jeff/public_html/netcontacts/setup.php(22): Net_LDAP::connect(Array) #7 /home/jeff/public_html/netcontacts/edit_contact2.php(3): include('/home/jeff/publ...') #8 {main} thrown in /usr/share/pear/PEAR.php(863) : eval()'d code on line 1