Esempio n. 1
0
 /**
  * Move forward to next result item
  * Implements Iterator
  *
  * @throws Zend_Ldap_Exception
  */
 public function next()
 {
     if (is_resource($this->_current)) {
         $this->_current = @ldap_next_entry($this->_ldap->getResource(), $this->_current);
         /** @see Zend_Ldap_Exception */
         // require_once 'Zend/Ldap/Exception.php';
         if ($this->_current === false) {
             $msg = $this->_ldap->getLastError($code);
             if ($code === Zend_Ldap_Exception::LDAP_SIZELIMIT_EXCEEDED) {
                 // we have reached the size limit enforced by the server
                 return;
             } else if ($code > Zend_Ldap_Exception::LDAP_SUCCESS) {
                  throw new Zend_Ldap_Exception($this->_ldap, 'getting next entry (' . $msg . ')');
             }
         }
     }
 }
Esempio n. 2
0
 /**
  * @param Zend_Ldap $ldap A Zend_Ldap object
  * @param string    $str  An informtive exception message
  * @param int       $code An LDAP error code
  */
 public function __construct(Zend_Ldap $ldap = null, $str = null, $code = 0)
 {
     $errorMessages = array();
     $message = '';
     if ($ldap !== null) {
         $oldCode = $code;
         $message = $ldap->getLastError($code, $errorMessages) . ': ';
         if ($code === 0) {
             $message = '';
             $code = $oldCode;
         }
     }
     if (empty($message)) {
         if ($code > 0) {
             $message = '0x' . dechex($code) . ': ';
         }
     }
     if (!empty($str)) {
         $message .= $str;
     } else {
         $message .= 'no exception message';
     }
     parent::__construct($message, $code);
 }