The thing is very simple:
$results = ldap_search( $ldapconn, 'DC=testdomain,DC=com', '(&(objectClass=user)(objectClass=computer))' );
This works, getting 3 results.
However, negating the second expression as defined in many manuals and tutorials, returns in Bad Search Filter:
$results = ldap_search( $ldapconn, 'DC=testdomain,DC=com', '(&(objectClass=user)(!objectClass=computer))' );
Any help?
[Wed Apr 10 16:59:05 2013] [error] [client 127.0.0.1] PHP Warning: ldap_search(): Search: Bad search filter in /var/www/test2.php on line 29
I think it's because I trusted Microsoft Active Directory's Documentation on LDAP:
http://technet.microsoft.com/en-us/library/aa996205%28v=exchg.65%29.aspx
Other sites mentions the (!(expression)) like http://www.google.com/support/enterprise/static/postini/docs/admin/en/dss_admin/prep_ldap.html