Re: RE: PHP 4.0 Bug #9351 Updated: LDAP_SEARCH

From: Date: Sat, 24 Feb 2001 12:04:01 +0000
Subject: Re: RE: PHP 4.0 Bug #9351 Updated: LDAP_SEARCH
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-47374@lists.php.net to get a copy of this message
On Wed, Feb 21, 2001 at 08:49:25AM +0800, nikony wrote: > I have thought about that but as you know, it's now a fault of LDAP Server. I use open > ldap and when i use command line: > ldapsearch -p 999 -h localhost -b ... "(date >=20010116)" > it works! and even more: > ldapsearch -p 999 -h localhost -b ... "(&(date > >=20010116)(date<=20010120))" > It's puzzling,right? Yes. I just did a test and it worked well for me! PHP doesn't do anything with the string you pass as filter, it's simply passed to the ldap_search function of the LDAP library. I did a test with OpenLDAP 2.0.x libraries and server and it worked well. What is important is that the attribute has defined ORDERING in the schema, for example: ORDERING caseIgnoreOrderingMatch If it isn't, it shouldn't work neither with PHP nor ldapsearch. Anyway, it worked, and I can't see any reason it shouldn't. I have a server up and running that you could test against if you like. Here's the PHP code I used: $ds=ldap_connect("ldap://silkesvarten.uninett.no/"); if ($ds) { $sr=ldap_search($ds,"dc=my-domain,dc=com", "ttl<=14400"); echo "Search result is $sr \n"; echo "Number of entires returned is ", ldap_count_entries($ds,$sr), "\n"; $info = ldap_get_entries($ds, $sr); echo "Data for ", $info["count"], " items returned:\n"; for ($i=0; $i<$info["count"]; $i++) { echo "dn is: ", $info[$i]["dn"], "\n"; echo "dc : ", $info[$i]["dc"][0], "\n"; echo "ttl: ", $info[$i]["ttl"][0], "\n\n"; } ldap_close($ds); } else { echo "Unable to connect to LDAP server"; } If this fails I suspect the LDAP library (which one?), if it works it's your LDAP server (which one?) and the attribute definition is the most likely cause. But if your ldapsearch worked it can't be the server, so I'm puzzled. Please try my script anyway. Could I test against your server? Stig

« previous php.dev (#47374) next »