Fix ambiguous test on ldap return of getAttributes

This commit is contained in:
Laurent Destailleur 2016-05-29 11:20:12 +02:00
parent ba43297936
commit 22d6d9497e
5 changed files with 10 additions and 10 deletions

View File

@ -191,12 +191,12 @@ if ($result > 0)
} }
else else
{ {
$records=$ldap->getAttribute($dn,$search); $records = $ldap->getAttribute($dn,$search);
//print_r($records); //print_r($records);
// Affichage arbre // Affichage arbre
if (count($records) && $records != false && (! isset($records['count']) || $records['count'] > 0)) if ((! is_numeric($records) || $records != 0) && (! isset($records['count']) || $records['count'] > 0))
{ {
if (! is_array($records)) if (! is_array($records))
{ {

View File

@ -170,12 +170,12 @@ if ($result > 0)
$info=$object->_load_ldap_info(); $info=$object->_load_ldap_info();
$dn=$object->_load_ldap_dn($info,1); $dn=$object->_load_ldap_dn($info,1);
$search = "(".$object->_load_ldap_dn($info,2).")"; $search = "(".$object->_load_ldap_dn($info,2).")";
$records=$ldap->getAttribute($dn,$search); $records = $ldap->getAttribute($dn,$search);
//var_dump($records); //var_dump($records);
// Affichage arbre // Affichage arbre
if (count($records) && $records != false && (! isset($records['count']) || $records['count'] > 0)) if ((! is_numeric($records) || $records != 0) && (! isset($records['count']) || $records['count'] > 0))
{ {
if (! is_array($records)) if (! is_array($records))
{ {

View File

@ -823,7 +823,7 @@ class Ldap
* *
* @param string $dn DN entry key * @param string $dn DN entry key
* @param string $filter Filter * @param string $filter Filter
* @return int|false|array <0 or false if KO, array if OK * @return int|array <0 or false if KO, array if OK
*/ */
function getAttribute($dn,$filter) function getAttribute($dn,$filter)
{ {
@ -848,7 +848,7 @@ class Ldap
{ {
$this->ldapErrorCode = -1; $this->ldapErrorCode = -1;
$this->ldapErrorText = "Couldn't find entry"; $this->ldapErrorText = "Couldn't find entry";
return false; // Couldn't find entry... return 0; // Couldn't find entry...
} }
// Get values // Get values
@ -856,7 +856,7 @@ class Ldap
{ {
$this->ldapErrorCode = ldap_errno($this->connection); $this->ldapErrorCode = ldap_errno($this->connection);
$this->ldapErrorText = ldap_error($this->connection); $this->ldapErrorText = ldap_error($this->connection);
return false; // No matching attributes return 0; // No matching attributes
} }
// Return an array containing the attributes. // Return an array containing the attributes.

View File

@ -177,7 +177,7 @@ if ($result > 0)
//var_dump($records); //var_dump($records);
// Affichage arbre // Affichage arbre
if (count($records) && $records != false && (! isset($records['count']) || $records['count'] > 0)) if ((! is_numeric($records) || $records != 0) && (! isset($records['count']) || $records['count'] > 0))
{ {
if (! is_array($records)) if (! is_array($records))
{ {

View File

@ -181,12 +181,12 @@ if ($result > 0)
$info=$object->_load_ldap_info(); $info=$object->_load_ldap_info();
$dn=$object->_load_ldap_dn($info,1); $dn=$object->_load_ldap_dn($info,1);
$search = "(".$object->_load_ldap_dn($info,2).")"; $search = "(".$object->_load_ldap_dn($info,2).")";
$records=$ldap->getAttribute($dn,$search); $records = $ldap->getAttribute($dn,$search);
//print_r($records); //print_r($records);
// Affichage arbre // Affichage arbre
if (count($records) && $records != false && (! isset($records['count']) || $records['count'] > 0)) if ((! is_numeric($records) || $records != 0) && (! isset($records['count']) || $records['count'] > 0))
{ {
if (! is_array($records)) if (! is_array($records))
{ {