diff --git a/lib/Net/LDAP3.php b/lib/Net/LDAP3.php index 0d3c875d09d8172d6ec16811bdd8e9fe670aab84..9182347d7f4909e1f18929037e9cc15c37708203 100644 --- a/lib/Net/LDAP3.php +++ b/lib/Net/LDAP3.php @@ -600,7 +600,7 @@ class Net_LDAP3 return false; } - if (is_resource($this->conn)) { + if (isset($this->conn) && $this->conn !== false) { $this->_debug("Connection already exists"); return true; } @@ -644,7 +644,7 @@ class Net_LDAP3 $this->_debug("S: NOT OK"); } - if (!is_resource($this->conn)) { + if (!isset($this->conn) || $this->conn === false) { $this->_error("Could not connect to LDAP"); return false; } diff --git a/lib/Net/LDAP3/Result.php b/lib/Net/LDAP3/Result.php index ef57cc8f189bcaa46a6da6b9fa0c78fae2434440..8ee788a721b94c3bf33764d2887e8763cacccbff 100644 --- a/lib/Net/LDAP3/Result.php +++ b/lib/Net/LDAP3/Result.php @@ -147,6 +147,7 @@ class Net_LDAP3_Result implements Iterator /*** Implement PHP 5 Iterator interface to make foreach work ***/ + #[ReturnTypeWillChange] function current() { $attrib = ldap_get_attributes($this->conn, $this->current); @@ -155,25 +156,29 @@ class Net_LDAP3_Result implements Iterator return $attrib; } + #[ReturnTypeWillChange] function key() { return $this->iteratorkey; } + #[ReturnTypeWillChange] function rewind() { $this->iteratorkey = 0; $this->current = ldap_first_entry($this->conn, $this->result); } + #[ReturnTypeWillChange] function next() { $this->iteratorkey++; $this->current = ldap_next_entry($this->conn, $this->current); } + #[ReturnTypeWillChange] function valid() { - return (bool)$this->current; + return (bool) $this->current; } }