my result for the test user 'ostclient' in my testing domain looks like the following:
calling ldap_connect with: "ldaps://192.168.178.40"
setting LDAP_OPT_PROTOCOL_VERSION to 3 and LDAP_OPT_REFERRALS to 0
binding to ldap with "administrator@vpg.local" and his password
using the filter: "(&(sAMAccountName=ostclient))"
calling ldap_search with the domain: "DC=vpg,DC=local", the Filter: "(&(sAMAccountName=ostclient))" and the Attributes: "array("cn")"
LDAP returned field data: "ost client"
Debug of function ldapGetEmail():
getting the email of user: "ostclient"
binding to ldap with "administrator@vpg.local" and his password
calling ldap_search with the domain: "DC=vpg,DC=local", the Filter: "(&(sAMAccountName=ostclient))" and the Attributes: "array("mail")"
LDAP returned field data: "ost.client@vpg.de"
Debug of function ldapGetUsernameFromEmail():
getting the user of email: "ost.client@vpg.de"
binding to ldap with "administrator@vpg.local" and his password
calling ldap_search with the domain: "DC=vpg,DC=local", the Filter: "(&(mail=ost.client@vpg.de))" and the Attributes: "array("samaccountname")"
LDAP returned field data: "ostclient"
The 'ldap returned nothing' is expected, since you've left the user field of test ldap empty. Other than that it looks alright to me. Binding seems to work and you get data from the fields.