Skip to content

Commit

Permalink
Merge pull request #271 from JediKev/ldap/php8.1-support
Browse files Browse the repository at this point in the history
Reviewed-By: JediKev <[email protected]>
  • Loading branch information
JediKev authored Jun 12, 2023
2 parents 58aef96 + 094219d commit 215dced
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lib/pear-pear.php.net/net_ldap2/Net/LDAP2/Entry.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ public function __construct($ldap, $entry = null)
parent::__construct('Net_LDAP2_Error');

// set up entry resource or DN
if (is_resource($entry)) {
if ($entry !== false) {
$this->_entry = $entry;
} else {
$this->_dn = $entry;
Expand All @@ -161,7 +161,7 @@ public function __construct($ldap, $entry = null)
if ($ldap instanceof Net_LDAP2) {
$this->_ldap = $ldap;
$this->_link = $ldap->getLink();
} elseif (is_resource($ldap)) {
} elseif ($ldap !== false) {
$this->_link = $ldap;
} elseif (is_array($ldap)) {
// Special case: here $ldap is an array of attributes,
Expand All @@ -173,7 +173,7 @@ public function __construct($ldap, $entry = null)

// if this is an entry existing in the directory,
// then set up as old and fetch attrs
if (is_resource($this->_entry) && is_resource($this->_link)) {
if (($this->_entry !== false) && ($this->_link !== false)) {
$this->_new = false;
$this->_dn = @ldap_get_dn($this->_link, $this->_entry);
$this->setAttributes(); // fetch attributes from server
Expand Down Expand Up @@ -235,7 +235,7 @@ public static function createConnected($ldap, $entry)
if (!$ldap instanceof Net_LDAP2) {
return PEAR::raiseError("Unable to create connected entry: Parameter \$ldap needs to be a Net_LDAP2 object!");
}
if (!is_resource($entry)) {
if ($entry == false) {
return PEAR::raiseError("Unable to create connected entry: Parameter \$entry needs to be a ldap entry resource!");
}

Expand Down Expand Up @@ -354,7 +354,7 @@ protected function setAttributes($attributes = null)
/*
* fetch attributes from the server
*/
if (is_null($attributes) && is_resource($this->_entry) && is_resource($this->_link)) {
if (is_null($attributes) && ($this->_entry !== false) && ($this->_link !== false)) {
// fetch schema
if ($this->_ldap instanceof Net_LDAP2) {
$schema = $this->_ldap->schema();
Expand Down Expand Up @@ -767,7 +767,7 @@ public function update($ldap = null)

// Get and check link
$link = $ldap->getLink();
if (!is_resource($link)) {
if ($link == false) {
return PEAR::raiseError("Could not update entry: internal LDAP link is invalid");
}

Expand Down

0 comments on commit 215dced

Please sign in to comment.