vasilenicusor - 2012-08-29

Hi.
I have a strange situation with my LDA when i get userinfo.

First situation: don't work

<?php
require_once(dirname(__FILE__) . '/adLDAP.php');
$ad_options = array ( "port" => "3268",
                                        "account_suffix" => "@mydomain.com",
                                        "base_dn" => "DC=mydomain,DC=com",
                                        "domain_controllers" => Array ( "mydomain.com ")
                                       );
$adldap = new adLDAP($ad_options);
 $LDAPUser = "myuser";        //A valid Active Directory login
 $LDAPUserPassword = "mypass";
 $SearchFor="username";  
$adldap->authenticate( $LDAPUser, $LDAPUserPassword );  // OK
$info=$adldap->user()->info($SearchFor,array('mail', 'displayname'));
 $adldap->close();
print_r($info);  // print nothing :(
?>

Second situation: work OK

 $SearchFor="username";  
  $LDAPHost = "mydomain.com";     
  $dn = "DC=mydomain,DC=com";
  $LDAPUserDomain = "@mydomain.com"; 
  $LDAPUser = "myuser";        //A valid Active Directory login
  $LDAPUserPassword = "mypass";
  $LDAPFieldsToFind = array("cn", "samaccountname", "mail");
   
  $cnx = ldap_connect($LDAPHost,3268) or die("Could not connect to LDAP");
  ldap_set_option($cnx, LDAP_OPT_PROTOCOL_VERSION, 3);  
  ldap_set_option($cnx, LDAP_OPT_REFERRALS, 0);        
  ldap_bind($cnx,$LDAPUser.$LDAPUserDomain,$LDAPUserPassword) ;
  $filter = "(&(objectCategory=person)(|(sn=$SearchFor*)(|(samaccountname=$SearchFor*)(cn=$SearchFor*))))";
  $sr=ldap_search($cnx, $dn, $filter, $LDAPFieldsToFind);
  $info= ldap_get_entries($cnx, $sr);
print_r($info);  // print  user info OK

Why first situation  don't work ?
Thanks