/** * 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); if ($this->_current === false) { $msg = $this->_ldap->getLastError($code); if ($code === Ldap\Exception::LDAP_SIZELIMIT_EXCEEDED) { // we have reached the size limit enforced by the server return; } else { if ($code > Ldap\Exception::LDAP_SUCCESS) { throw new Ldap\Exception($this->_ldap, 'getting next entry (' . $msg . ')'); } } } } }
/** * Move forward to next result item * Implements Iterator * * @throws \Zend\Ldap\Exception\LdapException * @return */ public function next() { $code = 0; if (is_resource($this->current) && $this->itemCount > 0) { $this->current = @ldap_next_entry($this->ldap->getResource(), $this->current); if ($this->current === false) { $msg = $this->ldap->getLastError($code); if ($code === Exception\LdapException::LDAP_SIZELIMIT_EXCEEDED) { // we have reached the size limit enforced by the server return; } elseif ($code > Exception\LdapException::LDAP_SUCCESS) { throw new Exception\LdapException($this->ldap, 'getting next entry (' . $msg . ')'); } } } else { $this->current = false; } }
/** * @param Ldap $ldap Zend\Ldap\Ldap object * @param string $str Informative exception message * @param int $code LDAP error code */ public function __construct(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); }