adldap / adLDAP

adLDAP is a PHP class that provides LDAP authentication and integration with Active Directory.
GNU Lesser General Public License v2.1
424 stars 204 forks source link

$ldap->user()->info($username, $fields) always returns "false" #114

Open yarosdev opened 8 years ago

yarosdev commented 8 years ago

$ldap->user()->info($username, $fields); This method always returns false.

After removing "escape(value)" info method of user works fine

Adldap\Query\Builder line 235:
private function addWhere($field, $operator, $value = null)
{
    $this->wheres[] = [
        'field' => $field,
        'operator' => $this->getOperator($operator),
        'value' => $value,//$this->connection->escape($value),
    ];
}
XONOSNET commented 6 years ago

It doesn't return false. It returns an object, assuming that $fields is an array of valid attributes to filter.

ie:

$ldap = new adLDAP();
$userdata = $ldap->user()->info('john.doe',array('*'));
echo $userdata->displayName;
//Outputs: John Doe

With this being said, I used to (with older versions) be able to run the following:

$ldap = new adLDAP();
$userdata =  $ldap->user()->info('john.doe',array('*'));
echo '<pre>'.print_r(json_decode(json_encode($userdata[0])),1).'</pre>';

I would occasionally do this because the users in my network have hundreds of populated attributes and I often want running examples. Now, when I do this - I get a null result. Still trying to figure out what's changed.