Bug #12372: LDAP calls within a function fail

From: Date: Wed, 25 Jul 2001 17:24:34 +0000
Subject: Bug #12372: LDAP calls within a function fail
Groups: php.dev 
Request: Send a blank email to php-dev+get-60981@lists.php.net to get a copy of this message
From: Mike@ftl.com Operating system: RedHat 7.0 PHP version: 4.0.6 PHP Bug Type: LDAP related Bug description: LDAP calls within a function fail When doing LDAP calls from within a function, it always returns 'Warning: 1 is not a LDAP link index in blah.php on line 12' If I take the same code and put it in a .php file by itself it works great. <? $ds=ldap_connect("blah.com") || die('Connection Failed'); if ($ds) { $dn = "ou=people, o=blah.com"; $r=ldap_bind($ds); $justthese = array( "ou", "sn", "givenname", "mail", "telephonenumber", "mobile", "title"); $filter = "sn=*"; $sr=ldap_search($ds, $dn, $filter, $justthese); $info = ldap_get_entries($ds, $sr); for ($i=0; $i<$info["count"]; $i++) { echo "dn is: ". $info[$i]["dn"] ."<br>"; echo "first name is: ". $info[$i]["givenname"][0] ."<br>"; echo "lastname is: ". $info[$i]["sn"][0] ."<br>"; echo "title is : ". $info[$i]["title"][0] ."<br>"; echo "email is : ". $info[$i]["mail"][0] ."<br>"; echo "telephone is : ". $info[$i]["telephonenumber"][0] ."<p>"; } ldap_close($ds); } ?> I don't get the error at the ldap_connect line so it makes the connection. But when it gets to the ldap_bind it bombs out. Here is my config line.... ./configure --with-apache=../apache_1.3.20 --with-gd --with-pdflib=/usr/local --disable-debug --with-mnogosearch=/usr /local/mnogosearch --with-mysql=/usr --with-zlib --enable-inline-optimization --with-gnu-ld --enable-memory-limit --enab le-track-vars --with-jpeg-dir=/usr --with-tiff-dir=/usr --with-ttf=/usr --with-system-regex=yes --with-png-dir=/usr/lib --enable-trans-sid --enable-gd-imgstrttf --with-ldap=/usr/local/ldap Any help would be great. - Mike -- Edit bug report at: http://bugs.php.net/?id=12372&edit=1

« previous php.dev (#60981) next »